web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Parameters in the cloud

(0) ShareShare
ReportReport
Posted on by 555

Hi experts,

In an old NAV, I have a solution where some code is added in the middle of codeunit 80, procedure PostItemJnlLine. The code must only be run sometimes. It is controllede by an extra parameter on the procedure. So depending on where PostItemJnlLine is called from, the extra parameter is set to true or false.

How do I do that in Business Central cloud?

I can add my code to one of the "On..." procedures, but is there a way to send an extra parameter to a standard procedure like PostItemJnlLine or can I set a global variable in codeunit 80 somehow?

Is it possible for my code in the "On..." procedure to communicate with one of the calling programs higher up in the call stack?

My situation is like this:

Procedure A:

PostItemJnlLine(..., true);

Procedure B:

PostItemJnlLine(..., false);

PostItemJnlLine:

...

if parameter then

    runExtraCode...

 

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,794 Moderator on at

    Hi Morten,

    Unfortunately we dont have those option now when we are working on Latest AL code of BC, we have this option only on C/AL version.

    To overcome this problem we only have some Event subscriber available to use most of the case. You have to move your CAL code from the functions and move to the respected event of the CU.

    Please refer the below link

    docs.microsoft.com/.../devenv-subscribing-to-events

  • Suggested answer
    Morten Steengaard Profile Picture
    555 on at

    Hi Nitin Verma,

    Thank you for your reply.

    It works now. I use some event subscribers and I have made a new singleInstance codeunit to hold my boolean. So in my codeunit, I save the parameter in the boolean and when I get to where I must use it, I have an event subscriber that reads the boolean in the codeunit.

    Best regards,

    Morten

  • Suggested answer
    Nitin Verma Profile Picture
    21,794 Moderator on at

    Awesome.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,122 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,148 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 733 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans