Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Global Variables in Visual Studio Code NAV 2018

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

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Global Variables in Visual Studio Code NAV 2018

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Global Variables in Visual Studio Code NAV 2018

    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
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Global Variables in Visual Studio Code NAV 2018

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans