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 :
Business Central forum

Codeunit Customisation

(0) ShareShare
ReportReport
Posted on by 30

Hello guys,

I am creating a new codeunit where im subscribing to a base codeunit i.e.(Item Jnl.-Post Line), I need to update a global variable so can you please tell me how to achieve this. In the screenshot mentioned below I want to update the field applied qty in my codeunit. how can I do it?

pastedimage1568982726206v1.png        pastedimage1568982782357v2.png

Categories:
I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    You cannot update the field because the publisher function does not include GlobalVarAccess. Its explained here https://docs.microsoft.com/en-us/dynamics-nav/globalvaraccess-property

    If the GlobalVarAccess was included then you could add Global variables to your Subscriber parameters and set values in your subscriber. 

    Tero

  • Prashant_Kumar Profile Picture
    30 on at

    Thanks for the information Tero. Is there anyway I can achieve it or it’s not possible at all?

  • Verified answer
    Community Member Profile Picture
    on at

    As far as I know this is not possible. Just out of curiosity, why do you need to set the AppliedQty to 0 ?

    Tero

  • Verified answer
    MohitMalik8085 Profile Picture
    100 on at

    Hi Prashant,

    This is not possible to change the value of the global variable of a base codeunit if you don't have the right event to subscribe.

    You are subscribing the event OnAfterApplyItemLedgEntry, which is not having the property Yes for GlobalVarAccess.

    Also you are not advised to modify the property manually which will not working properlly and you don't have the rights to change the event property in the extensions.

    Tero Hassinen has given the right answer, as per best of my knowledge.

    Capture0001.PNG

    Regards

    Mohit Malik

  • Prashant_Kumar Profile Picture
    30 on at

    For a customization for one of our customer I needed to do this.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans