Extensability of Item Template
Hi everybody,
I was currently trying to extend the "Item Template" for some fields. I noticed the following things:
-
In my opinion it would make sense, to make a function like "AddToArray" of Table 1301 accessable. So you don't have to "rebuild" it in your own extension.
-
Also, it would be good, to make "Rec" of Table 1301 accessable in the Event "OnAfterCreateFieldRefArray". So you don't have to work with the fieldnumbers of your new fields.

It's also not possible to skip the validation of field, when an item template is getting applied.
I think something like this would be helpfull:

Best regards,
Hendrik
Hello Hendrik,
Thank you for your suggestion, but we can only provide the OnBeforeUpdateWithSkipFields event .
The AddToArray function can only be used for the 17 first fields. The event allow you to add 6 extra Fields. The code you are showing replaces the 5 first fields.
Working with the field numbers cannot be avoided as the only way to get to FieldRef is by a RecordRef and the Field number you can define your own Record variable and use it to get the field numbers. I would suggest the following.
var
ItemTemplate: Record "Item Template";
begin
FieldRedArray[18] := RecRef.Field(ItemTemplate.FieldNo("Custom Field 1");
FieldRedArray[19] := RecRef.Field(ItemTemplate.FieldNo("Custom Field 2");
FieldRedArray[20] := RecRef.Field(ItemTemplate.FieldNo("Custom Field 3");
FieldRedArray[21] := RecRef.Field(ItemTemplate.FieldNo("Custom Field 4");
FieldRedArray[22] := RecRef.Field(ItemTemplate.FieldNo("Custom Field 5");
end;
Cheers, Giorgos
Hey @GiorgosPa, What would happen if two extensions uses the same FieldRedArray index?
That would be unfortunate, one will override the other
Closing as won't fix. We plan to stop using "mini templates" and switch to Config. Templates. They are used as basis for “mini” and they are fully extensible without any additional actions. We are investigating how to address the usability issue with Config Templates.
Any timeline?