Business Integration Solutions Documentation
Extension Points
Extension points are specific places in the application where you can add or modify functionality without altering the base code. These extension points allow developers to customize and extend the application in a modular and maintainable way. Here are some key types of extension points:
Extension points are of two types
Existing extension Points
Internal Document import extention points :
OnAfterMigrateFieldID : The publisher OnafterMigrateFieldID has a reference in Internal document import
Code
procedure MigrateFieldId(BISVersion: Text; TableId: Integer; FieldId: Integer) NewFieldId: Integer
var
Handled: Boolean;
begin
OnAfterMigrateFieldID(BISVersion, TableId, FieldId, NewFieldId, Handled);
if not Handled then
NewFieldId := FieldId;
end;
[IntegrationEvent(false, false)]
local procedure OnAfterMigrateFieldID(BISVersion: Text; TableId: Integer; OldFieldId: Integer; var NewFieldId: Integer; var Handled: Boolean)
begin
end;
Example
"BIS Document Line"."Field No." := TranslatorCU.MigrateFieldId(BISVersion, "BIS Document Line"."Table No.", "BIS Document Line"."Field No.");
OnAfterMigrateObjectID: The publisher OnafterMigrateobjectID has couple of reference in Internal document import and in Event generator setup.
Code
procedure MigrateObjectId(BISVersion: Text; ObjType: ObjectType; OldObjectId: Integer) NewObjectId: Integer
var
Handled: Boolean;
begin
OnAfterMigrateObjectID(BISVersion, ObjType, OldObjectId, NewObjectId, Handled);
if not handled then
OnAfterTranslateObjectID(objtype, OldObjectId, NewObjectId, Handled);
if not Handled then
NewObjectId := OldObjectId;
end;
[IntegrationEvent(false, false)]
local procedure OnAfterMigrateObjectID(BISVersion: Text; Type: ObjectType; OldId: Integer; var NewId: Integer; var Handled: Boolean)
begin
end;
Example
In internal Document
"BIS Document Line"."Table No." := TranslatorCU.MigrateObjectId(BISVersion, ObjectType::Table, "BIS Document Line"."Table No.");
In Event Generator xmlport
"BIS Event Generator Setup"."Object ID to Run" := TranslateId.MigrateObjectId(BISVersion, ObjectType::Codeunit, "BIS Event Generator Setup"."Object ID to Run");
Mapper import extention point :
OnAfterMigrateExpression : The publisher OnafterMigrateExpression has a reference in Mapping expression xml port.
Code
procedure MigrateExpression(BISVersion: Text; Expression: Text) NewExpression: Text
var
cuPos: integer;
lblCodeunit: text;
dotPos: integer;
CuID: integer;
newCuID: integer;
Result: Text;
Handled: Boolean;
begin
lblCodeunit := 'codeunit:';
while Lowercase(Expression).Contains(lblCodeunit) do begin
cupos := Lowercase(Expression).indexof(lblCodeunit) + strlen(lblCodeunit) - 1;
Result += Expression.Substring(1, cupos);
Expression := copystr(Expression, cupos + 1);
dotPos := Expression.indexof('.');
if dotPos > 1 then
if evaluate(cuid, Expression.substring(1, dotpos - 1)) then begin
newcuid := MigrateObjectId(BISVersion, ObjectType::Codeunit, cuid);
if newcuid <> cuid then begin
Result += format(newcuid);
Expression := copystr(Expression, dotpos);
end;
end;
end;
Result += Expression;
OnAfterMigrateExpression(BISVersion, Result, NewExpression, Handled);
if not Handled then
NewExpression := Result;
[IntegrationEvent(false, false)]
local procedure OnAfterMigrateExpression(BISVersion: Text; Expression: Text; var NewExpression: Text; var Handled: Boolean)
begin
end;
end;
Example
if VersionDec < 5.2 then
StreamExp := expression
else begin
TempBlob.CreateOutStream(BCOutStream, TextEncoding::UTF8);
Base64Convert.FromBase64(expression, BCOutStream);
TempBlob.CreateInStream(BCInStream, TextEncoding::UTF8);
while not BCInStream.EOS() do begin
BCInStream.Read(StreamLine);
StreamExp += StreamLine;
end;
end;
StreamExp := Translator.MigrateExpression(BISVersion, StreamExp);
"BIS Mapping Line".SaveExpression(StreamExp);
Mapper Activitiy Extension Points :
OnBeforeRunActivity: The publisher OnBeforeRunActivity allows you to add custom logic or validation before the mapper activity is executed. The source used for mapping is in the message body for onbeforerunactivity and recref contains the record reference setup.
Code
procedure RunActivity(var Message: Record "BIS Message Queue")
var
MappingSetup: Record "BIS Document Mapping Setup";
RecRef: RecordRef;
begin
OnBeforeRunActivity(Message, RecRef);
Message.ReadActivitySetup(RecRef);
RecRef.SetTable(MappingSetup);
ApplyMapping(MappingSetup, Message);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeRunActivity(var Message: Record "BIS Message Queue"; var RecRef: RecordRef)
begin
end;
Example
MessageQueue.Get(Message.GetMessageQueueId());
MessageQueue.CalcFields("Message Body");
CODEUNIT.Run(CODEUNIT::"BIS Document Mapper", MessageQueue);
OnAfterRunActivity: The publisher OnAfterRunActivity allows you to add custom logic or validation after the mapper activity is executed. The source used for mapping is in the message body for onAfterrunactivity and recref contains the record reference setup.
Code
procedure RunActivity(var Message: Record "BIS Message Queue")
var
MappingSetup: Record "BIS Document Mapping Setup";
RecRef: RecordRef;
begin
OnBeforeRunActivity(Message, RecRef);
Message.ReadActivitySetup(RecRef);
RecRef.SetTable(MappingSetup);
ApplyMapping(MappingSetup, Message);
OnAfterRunActivity(Message, RecRef);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterRunActivity(var Message: Record "BIS Message Queue"; var RecRef: RecordRef)
begin
end;
Example
MessageQueue.Get(Message.GetMessageQueueId());
MessageQueue.CalcFields("Message Body");
CODEUNIT.Run(CODEUNIT::"BIS Document Mapper", MessageQueue);
MessageQueue.Modify();
Message.Load(MessageQueue."Entry No.");
Request New Extension Points
STAEDEAN is happy to accomodate new extention points in the product to assist and automate migration scenarios. please find link for how to request new extension points