Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

trigger a method upon workflow completion.

Posted on by 922

Hello, Dax community,

I want to trigger a method which adds the approved lines of the workflow to another table. To achieve this I have added this code to insert method of workflowworkitemtable.

super();

iscorrecttable= this.RefTableId == tableNum(tableUsedinworkflow) ? true : false;
if(iscorrecttable)
{
MYtable::handleWorkflowUser(WorkflowWorkItemInstanceId);
}

It was working fine until recently it missed some lines means approved line are not in required table.

Is there another place where I could add this code (End 3 4 lines) like workflow class. 

So that it only trigger upon workflow completion not on approval.

regards,

Khurshid Wali

*This post is locked for comments

  • Verified answer
    Satish Panwar Profile Picture
    Satish Panwar 14,645 on at
    RE: trigger a method upon workflow completion.

    Hi Khurshid,

    Are you able to consistently replicate the issue of lines not getting inserted? If not, suggest you try to replicate, else you may not fix the problem. Assuming RefTableId was same for multiple records some of them got inserted and others not inserted.

    Your code as such looks fine to me in insert method.

    If you are looking where to code after completion, try in main data source modified field / update method as you must be changing original data source and setting up workflow stage to completed.

    Thanks,

    Satish Panwar

    Please take time to click yes against the answer that help guide you in right direction.

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