How can we flow a custom field from Journal to Ledger for AL project in VS Code for MSDYN365BC continued..

Hi ALL,

If you have not seen part 1 of this topic. How can we flow a custom field from Journal to Ledger for AL project in VS Code for MSDYN365BC.

So moving further with this topic we have seen

  1. Adding Field in Table as Table Extension
  2. Adding fields in Page as Page Extension
  3. Adding Code as Subscription in Codeunit.

Now lets move further.

3. Adding Code as Subscribtion in Codeunit in MSDYN365BC.

You can add New Codeunit and provide the event Subcriber

[EventSubscriber(ObjectType::<Event Publisher Object Type>, <Event Publisher Object>, '<Published Event Name>', '<Published Event Element Name>', <SkipOnMissingLicense>, <SkipOnMissingPermission>)] 
EventSubscriber in MSDYN365BC

I have added Procedure OnBeforeInsertCapLedgEntry

ArgumentDescriptionOptional
<Event Publisher Object Type>Specify the type of object that publishes the event. This can be CodeunitPageReportTable, or XMLPort.no
<Event Publisher Object>Specify the object that publishes the event. You can set this to the ID, such as 50100, or the recommended way is to use the object name by using the syntax <Object Type>::"<Object Name>", such as Codeunit::"MyPublishers", or for database triggers Database::"Customer".no
<Published Event Name>Specify the name of method that publishes the event in the object that is specified by the <Event Publisher Object> parameter.no
<Published Event Element Name>Specifies the table field that the trigger event pertains to. This argument only requires a value for database trigger events, that is, when the <Event Publisher Object Type> is set to Table and the <Published Event Name> argument is a validate trigger event, such as OnAfterValidateEvent.no
<SkipOnMissingLicense>Set to true to skip the event subscriber method call if the user’s license does not cover the event subscriber codeunit. If false, an error is thrown and the code execution stops. false is the default.yes
<SkipOnMissingPermission>Set to true to skip the event subscriber method call if the user does not have the correct permissions the event subscriber codeunit. If false, an error is thrown and the code execution stops. false is the default.yes

Try to post an output journal with Long Description and you can view the Long Description in Capacity Ledger entry after posting.

Self Learning Link by microsoft.

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn

Thanks for reading.

One thought on “How can we flow a custom field from Journal to Ledger for AL project in VS Code for MSDYN365BC continued..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s