Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Posting in another Company

Posted on by 211

How can I run a codeunit for another company without using job queue
I want to approve a Purchase Invoice in another company.

so we have 5 companies
approvers will have to go into every company and approve it, which is quite annoying for few approvers.
I can display all approvals from all company into one list but when he approves it errors, even I use changecompany function.

ApprovalEntry.CHANGECOMPANY('Company 2');
ApprovalsMgmt.ApproveApprovalRequests(ApprovalEntry);



Any advise?

Thanks

  • Ajay Jain Profile Picture
    Ajay Jain 211 on at
    RE: Posting in another Company

    Thank you ZHU

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,339 Super User 2024 Season 2 on at
    RE: Posting in another Company

    Hi, maybe SessionSettings Data Type will helps.

    More details: https://yzhums.com/13662/

    Hope this helps.

    Thanks.
    ZHU

  • Suggested answer
    Ajay Jain Profile Picture
    Ajay Jain 211 on at
    RE: Posting in another Company

    I think StartSession will do the job

  • Ajay Jain Profile Picture
    Ajay Jain 211 on at
    RE: Posting in another Company

    Validate works on the same company, cannot trigger in another company

    also there are other validations , reading other tables, those should also be have change company etc.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,133 Super User 2024 Season 2 on at
    RE: Posting in another Company

    Just a thought: Can you create a field in ApprovalEntry (ex: boolean) and make it to true and in OnValidate trigger of the field run the ApprovalsMgmt.ApproveApprovalRequests(ApprovalEntry);?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans