Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Assign a new user/approver through code x++ to workflow after submitting

(0) ShareShare
ReportReport
Posted on by 160

Hi guys!

I have a custom requirement to assign one or more user/users to the workflow after submitting. 

I know, we can change the assigned user through WorkflowWorkItemTable but how can we assign a new user to the workflow.

I want to achieve this through code, as I am fetching the new users I want to assign from a custom criteria.

Regards,

Hamza

*This post is locked for comments

  • manasa133 Profile Picture
    manasa133 110 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi,

    I have a similar requirement. Could you please share the solution?

  • Hamza Bin Mushtaq Profile Picture
    Hamza Bin Mushtaq 160 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Jonathan,

    Thanks for your help.

    It been a long time since this I had this requirement.

    It was about assigning the workflow item to a list of users (created dynamically based on some X criteria). At that time what I achieved was to assign new single user but my requirement is to assign a list of new users and I was stuck at it.

    I am not sure now, that I tried the Workflow Participant Provider.

    On some digging, I think this might solve the problem. I will try it whenever I find time to do so.

    Thanks.

    Regards,

    Hamza.

  • Verified answer
    Jonathan  Halland Profile Picture
    Jonathan Halland 11,306 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Hamza

    Can you explain you requirements in more details and where you are still struggling. The solution to your problem of "assigning to multiple users based on some custom criteria" is to use a workflow participant provider, unfortunately without any more details all we can do is point you to some code walk throughs on how to build one.

  • Hamza Bin Mushtaq Profile Picture
    Hamza Bin Mushtaq 160 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Raja,

    It would be great if you can share the working/tested solution.

    Regards,

    Hamza

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Jonathan,

    I got the solution already any way thank you..

  • Jonathan  Halland Profile Picture
    Jonathan Halland 11,306 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Raja.

    The way to accomplish this is through creating a WorkflowParticipantProvider. It allows you to assign in any way you wish. E.G. Assign based on a custom table (list of users) or rules etc

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Moiz,

    you got the solution????

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Ravi,

    Can you please share the solution.

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Hamza,

       I got the solution working fine now.

  • Hamza Bin Mushtaq Profile Picture
    Hamza Bin Mushtaq 160 on at
    RE: Assign a new user/approver through code x++ to workflow after submitting

    Hi Raja,

    Unfortunately, I have not found any solution to this problem yet.

    If you find anything related in the future, please share. It would be helpful for all community.

    Regards,

    Hamza

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans