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 AX (Archived)

how to add recall method in workflow AX 2012

(0) ShareShare
ReportReport
Posted on by 10,280

I need to recall the transaction after submiiting so how can I do that???

I need to set the status to draft again

*This post is locked for comments

I have the same question (0)
  • Muhammad Rizwan Idrees Profile Picture
    on at

    Write code to change the value of status field to draft in cancel method of workflow event handler class,

    Review cancel method of TSWorkflowEventHandler class for help

    PS: My assumption is that you have developed your own workflow????

  • Codehunter Profile Picture
    10,280 on at

    yes it is customized but at the same time,i need to change the status from cancelled to draft in case of Recall;

    How this can be done??can you send me  code??

  • Muhammad Rizwan Idrees Profile Picture
    on at

    Canceled method in workflow event handler class

    public void canceled(WorkflowEventArgs _workflowEventArgs)

    {

       ProjRFCTable projRFCTable;

       select forupdate projRFCTable where projRFCTable.RecId == _workflowEventArgs.parmWorkflowContext().parmRecId();

       if(projRFCTable.RecId && projRFCTable.ApprovalStatus !=ProjRFCApprovalStatus::rejected)

       {

           projRFCTable.ApprovalStatus = ProjRFCApprovalStatus::Draft;

           projRFCTable.write();

       }

    }

    Canceled method in workflow element event handler

    public void canceled(WorkflowElementEventArgs _workflowElementEventArgs)

    {

      ProjRFCTable projRFCTable;

       select forupdate projRFCTable where projRFCTable.RecId == _workflowElementEventArgs.parmWorkflowContext().parmRecId();

       if(projRFCTable.RecId && projRFCTable.ApprovalStatus!=ProjRFCApprovalStatus::rejected)

       {

           projRFCTable.ApprovalStatus = ProjRFCApprovalStatus::Draft;

           projRFCTable.write();

       }

    }

  • Codehunter Profile Picture
    10,280 on at

    so how I know if I pressed cancelled or recall?? there is no condition above clarifying that point??

  • Muhammad Rizwan Idrees Profile Picture
    on at

    Have you assigned CancelMenuItem to workflow type? If yes than which class it is calling, if it's default WorkflowCancelManager class than cancel method will be revoked, if you want different behavior than create your own class which should extend WorkflowCancelManager and write your code in that class. Example of this is PurchReqWFRecall class

  • Codehunter Profile Picture
    10,280 on at

    I did typically what you mentioned but I found out workflow unrecoverable and this means that the workflow won't start over ..any suggestions plz???

  • Codehunter Profile Picture
    10,280 on at

    plz somebody help me

  • Jonathan  Halland Profile Picture
    11,310 on at

    What was the error you recieved in workflow along with the "unrecoverable" state? Basically you should create a CancelledEventHandler event and link it to your WorkflowType AOT element. In this event handler you can set your document state back to draft.

    Can you also state what you have done and paste any applicable code here.

  • Codehunter Profile Picture
    10,280 on at

    I did but at the same time,the workflow wont start again ;it brings back with unrecoverable workflow

  • Codehunter Profile Picture
    10,280 on at

    plz somebody help me

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 AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans