Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Workflow in Ax 2012 R3 - Reject to Draft

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

  • Anton Tjiptadi Profile Picture
    Anton Tjiptadi 2,013 on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

    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.

  • Anand AX Profile Picture
    Anand AX 2,172 on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

    Thanks Sohaib, Will try and let you know.

  • Verified answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

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

  • Anand AX Profile Picture
    Anand AX 2,172 on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

    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.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

    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
    Anand AX 2,172 on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

    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
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Workflow in Ax 2012 R3 - Reject to Draft

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

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans