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)

Validation on Custom workflow

(0) ShareShare
ReportReport
Posted on by 632

Hi Friends, I created new custom workflow. My requirement is that before approve the workflow i want to do validation on approve button please tell me where will write the code.

Thanks you.

Rahul.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Hi Rahul.

    Remember that as a general principle Approvals do not /should not allow editing or modifying, also logic in your configurations/security should ensure that by the time an approval lands in somebody's list there should not be validation necessary. There are many other good reasons to avoid validation on this level.

    Tasks however are slightly different in that users are generally allowed to edit records when assigned a workflow task.

    That said, from a coding point of view they are both very similar in the background. You need to define a menu-item on your task/approval workflow node linked to a complete (or approve) outcome (you would already have done this). This menu-item that you created is linked to a class. In this class you can build in whatever validation you need and only execute the actual workflow code if the validation is met. A great example is class "PurchReqWorkItemActionManager"

    Take a look at the main method for the general flow that you need. the logic in the "Validate" method is entirely up to you

  • Rahul.p Profile Picture
    632 on at

    Thank for your support Jonathan, I will work on that and get back to you .

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans