how to add AL Extension code in between standard code?

Hi All

how do we add our AL Extension code for in between standard code

in C/AL, i used to add parameters.

here is one of the code in

Table 37 (Sales Line) - CalcVATAmountLines

Table 290 (VAT Amount Lines) - Sum Line

pastedimage1539077198626v3.png

Please advise how should we do it in AL

Thanks

Hi Stan,

You would need create your own function to update your fields and then call this function from an event subscriber. You can use the Event Recorder in BC to find out which events are published and then find where the subline function is called.

but this VAT Amount lines is just a buffer table.

I need this because in Statistic page I have new fields to be shown

I am not sure about event recorder

I tested start it… and then go to sales order, click statistics , and then go to VAT Amount lines

once i go back to event recorder, there is nothing there…

and the recorder is stopped

Getting the event recorder to work may need a few tries. In my case I noticed the if an error occurs, then it doesn’t record anything. But if going from the event recorder page (via search) to the page with the function I want to record, then do the process (with no errors - this is NOT a debugging tool) and exits back to the event recorder page. Then when I click Stop it asks me if I want to display the events that it recorded.

In you case then at least it should record when you opened the statistics page.

But you may be in a situation where there are no usable events to subscribe to. In which case you can do two things:

1: Go to AL on Github to request the event publishers you would need. This event then (maybe) will be added to the next major release. Or request it via MS support for current versions.

2: Create a new statistics page. Copy existing functions etc. and make your own page.

Requesting the event publisher may take 6 months or more to be available but only a few hours when available, where as creating the new could be done now, but take a lot more than with a subscriber. Not ideal, but the number of events is still limited, compared to how much functionality exists in NAV/BC.

any idea how to add code in AL here?

I am using Report 1496 (Suggest Bank Acc. Recon. Lines)

upon Suggest Bank recon lines, I added New field

in CAL, During EnterBankAccLine funtion I’ve added this code

As Eric suggest with page, you need to do the same thing, Create a new AL Object,

It is not possible to hook into this report where you want.

Use could use exporttonewsyntax and Txt2Al.exe, then you have the base object in AL.

Then you can modify that object.

  1. Base Object

  2. Base Object → converted become AL

  3. I modify this AL object from point no.

once i compile, isnt it will become redundant object?

something like error message, this object id already exist

Of course, you also need to give it a new object number, and use page extension or similar to replace where the old report is called.

Stan, your are completely missing the point with extensions. You cannot expect to convert an existing customization to extension with the same functionality. Extensions only offer a small subset of the customization capabilities we are used to in C/Side.

Instead you will often have to examine the underlying need this customization is trying to fulfill. Then you will often have to rethink how to fulfill this (or atleast some of it) with the limited capabilities you have with extensions. If the gap is too big, then you should either convince the customer that he/she doesn’t need this customization anymore or you will have to do a lot of copy-code to your own extension objects. This approach might not cause conflicts in future upgrades, but then your copy-code won’t benefit from Microsoft updates either.

hi all thanks for the reply…

i also have some requirement whereby, when user press post in Sales Order

need to be differentiated:

User A → Ship

User B → Invoice

User C → Ship & Invoice

in CSIDE we can change it directly in codeunit 81 Sales Post (Yes/No)

how do it in AL Extension?

Please advise

Thanks

Please ask new (unrelated) questions, in a new question in a new thread.

And please verify the answer to this question first. Thanks.

I think you need to create own CU and to change source page