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

Workflow in Ax 2012 R3 - Reject to Draft

(0) ShareShare
ReportReport
Posted on by 2,172

Hello All,

I am totally new to workflow, I have created one sample workflow based on workflow document, with Approved, Rejected, Submitted and Draft status. In workflow creation form, i used manual decision as given in the document followed.

Now its working fine for Approve and Cancel but not for Reject. when i reject the workflow, it should go back to Draft status to allow customer to Resubmit. But now when i Reject, its changing the status as Approved. I have manually created Reject method, in event handler class and its not triggered when i check it with debugger.

And i have created only the workflow category and workflow Type  not the Approvals(I think it is only causing problem) as the given in the document i followed. Could anyone clarify the workflow steps(especially the Approvals) or any document to achieve what i wanted to create?

*This post is locked for comments

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    what your workflow should do at time of clicking reject can be controlled by code. can you show us code behind Reject Event.

  • Anand AX Profile Picture
    2,172 on at

    Thanks for the reply, The below is the code i used for reject, and this method is  created manually by me on the event handler class.

    public void Rejected(WorkflowEventArgs _workflowEventArgs)

    {

    MRKPContractRequestPoolTable    MRKPContractRequestPoolTable;

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

    if(MRKPContractRequestPoolTable.RecId)

    {

    MRKPContractRequestPoolTable.ApprovalCRPStatus= ApprovalCRPStatus::Draft;

    MRKPContractRequestPoolTable.write();

    }

    }

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    kindly proceed to following  path

    \Workflow\Approvals\..your custom Approval

    Expand your custom approval. right click REJECT and click on properties.

    Note down Type. what is type for your Reject  Outcome?

  • Anand AX Profile Picture
    2,172 on at

    Hi Sohaib Cheema,

    I proceeded as you said, "Return" is the type my Reject outcome.

    For your kind information, i didn't created Approvals when is created sample workflow based on the document, Later on only(After all steps) i have created Approvals for the same workflow.

    Now my problem is i don't have much idea about Approvals and and how to use it.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    write above shown code in returned method of event handler class and retry after building Incremental CIL.

  • Anand AX Profile Picture
    2,172 on at

    Thanks Sohaib, Will try and let you know.

  • Anton Tjiptadi Profile Picture
    2,015 on at

    Hi Anand,

    Do you find solution for this ? I'm also facing the same problem, during Reject my code to update source table approval status is not working.

    PLease help.

    Thanks.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans