ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Extensability of Item Template

Open hendrik244 opened this issue 8 years ago • 5 comments

Hi everybody,

I was currently trying to extend the "Item Template" for some fields. I noticed the following things:

  1. 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.

  2. 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.

2018-11-27_1419

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: 2018-11-27_1603

Best regards,

Hendrik

hendrik244 avatar Nov 27 '18 15:11 hendrik244

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

GiorgosPa avatar Dec 14 '18 12:12 GiorgosPa

Hey @GiorgosPa, What would happen if two extensions uses the same FieldRedArray index?

gntpet avatar Feb 28 '19 08:02 gntpet

That would be unfortunate, one will override the other

GiorgosPa avatar Feb 28 '19 09:02 GiorgosPa

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.

AndreiPanko avatar Apr 24 '19 08:04 AndreiPanko

Any timeline?

gntpet avatar Apr 26 '19 11:04 gntpet