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)

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

I have the same question (0)
  • Mahmoud Hakim Profile Picture
    17,887 on at

    you can edit your workflow configuration and add a specific user from assignment tab 

  • Hamza Bin Mushtaq Profile Picture
    160 on at

    Hi Mahmoud,

    Thanks for your reply, but I am looking for a way to achieve this by code.

    Regards,

    Hamza

  • Suggested answer
    Ajit Profile Picture
    8,755 on at

    What is the actual problem or requirement here? You would be deciding workflow approvers on the fly? You can think of delegation feature of standard AX. Delegate method of SysWorkFlowWorKItem class

    SysWorkFlowWorkItem::delegate(workflowWorkItemTable, WorkflowWorkItemDelegationParameters.User,

                                                                      WorkflowWorkItemDelegationParameters.DelegateTo, 'Delegation');

  • Hamza Bin Mushtaq Profile Picture
    160 on at

    Hi Ajit,

    Thanks for your help.

    Yes, the actual requirement is that I have to assign a list of users at run time from a third table based on some specific criteria.

    I have already used this standard AX delegate method but it only solved half of my problem.

    Delegating the approval to the another single user is okay. But I want to Reassign/Assign the approval to a list of new users.

    Regards,

    Hamza

  • Ajit Profile Picture
    8,755 on at

    You can think of using work Item Queues then? Org Admin -> Setup -> Workflow -> Work item queues. And then you can assign users to that queue through code.

  • Hichem.Chekebkeb Profile Picture
    3,371 on at

    Couldn't you apply the conditions using AX workflow configurations? Can you illustrate more about the conditions you want to apply?

  • Verified answer
    Community Member Profile Picture
    on at

    You can try using Participant provider class. I hope it will help you!!!

    Below are the reference links:

    https://workflowax.wordpress.com/2009/10/21/basics-requirements-for-participant-provider-classes/

    https://workflowax.wordpress.com/2009/10/30/participant-provider-example/

     

  • Crispin John Augustine Profile Picture
    37,081 on at

    So, you already know the table, 'WorkflowWorkItemTable'

    If you need to create a workitem to a user (different from the one set in the configuration), you have to write that in the insert() method of the table, within your custom criteria.

    this.UserId = YourUser;

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    HI Hazma ,

    How about calling WorkflowWorkItemActionManager class dispatchWorkItemAction method in your customization in a loop for selected user. As suggested by Ajit this method accepts Queue as well .

  • Hamza Bin Mushtaq Profile Picture
    160 on at

    Hi Ajit,

    I have looked into it, but the queues only work for the review of the workflow.

    I need to set the users on the Approvals.

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans