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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Global Variables in Visual Studio Code NAV 2018

(0) ShareShare
ReportReport
Posted on by

Hello, 

I cannot access the global variables in visual studio code connected to NAV 2018. 
What is the workaround to this? 
Thanks,

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    What do you mean by access?

    In AL a global variable is declared using:

    var

           MyCustomer: Record Customer;

    This is declared at object level.

    If you declare a variable inside an event or a procedure, this variable is local to the event/procedure itself.

  • Community Member Profile Picture
    on at

    Hi Stefano,

    I have related question for you. Please help me out.

    when i'm trying to publish event of "OnBeforePostItemJnlLine" from codeunit "Item Jnl.-Post Line" in a new codeunit extension. i'm not able to use global variables of codeunit "Item Jnl.-Post Line" in my codeunit extension where i used "OnBeforePostItemJnlLine" event. any idea regarding this issue, How to use base code unit global variables in extension codeunits.

    Thanks & Regards,

    Prasanna.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Fot that, the Integration event (Publisher) must have GlobalVarAccess = true. This property is only available when the Event Property is set to Publisher and the EventType Property is set to Integration.

    You must add variable parameters to the event subscriber functions manually and use a name and type that matches the variable declaration in the event publisher object.

    Normally many MS events does not have GlobalVarAccess set to true. In this case you cannot access global variables.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans