Microsoft_MVP_banner

D365FO – Add new participant and type of participant to Participant workflow element

D365FO - Add new participant and type of participant to Participant workflow element
There are times when you want to add a new type of participant other than security role participants and user group participants, this post describes the steps to take and achieve this requirement.

This is the final output





























Let’s find out how did it work.

This is how each type of participant exists in AOT so a new Workflow Participant Assignment Provider needs to be created in order to see it in the Type of participant list as for this example ‘Vendor invoice approval provider’ is being added.
Created a new Workflow Participant Assignment Provider with the following properties.

Available For All Workflow Templates = No [Just want to have this new Participant type vendor invoice approval workflow]

Added new workflow type and link it with VendInvoiceApprovalJournalTemplate which is the workflow type name for Vendor tax invoice approval journal workflow 



Each provider has a Provider class and here is an example of the class used for above created participant provider

class FF_VendInvoiceWFParticipantProviderExpend  extends WorkflowParticipantProvider_Expend
{
    const str owner = ‘OWNER’;
    public WorkflowParticipantExpenDocumentType documentType()
    {
        return WorkflowParticipantExpenDocumentType::VendInvoice;
    }
    public WorkflowParticipantTokenList getParticipantTokens()
    {
        WorkflowParticipantTokenList tokenList = WorkflowParticipantTokenList::construct();
        tokenList = super();
        tokenList.add(owner, ‘@SYS77709’);
        return tokenList;
    }
    ///
<summary>
    ///     Resolves the vendor invoice line
dimensions to a list of users
    ///
</summary>
    /// <param
name=”_context”>
    ///     An instance of the
<c>WorkflowContext</c> class
    ///
</param>
    /// <param
name=”_participantTokenName”>
    ///     The participant token that is selected for
a role-based assignment.
    ///
</param>
    ///
<returns>
    ///     An instance of the
<c>WorkflowUserList</c> class that contains the enabled users from
the token
    ///
</returns>
    ///
<exception cref=”M:Exception::Error”>
    ///     Participant token does not exist
    ///
</exception>
    public WorkflowUserList resolve(WorkflowContext _context, WorkflowParticipantToken _participantTokenName)
    {
        LedgerJournalTable ledgerJournalTable = this.getLedgerJournalTableFromContext(_context);
        WorkflowUserList userList = WorkflowUserList::construct();
       
        if (_participantTokenName == owner)
        {
            userList.add(DirPersonUserEx::worker2UserId(LedgerJournalTable::findRecId(_context.parmRecId()).FF_Originator));
        }
        return userList;
   
    }    
    ///
<summary>
    /// Gets the
<c>LedgerJournalTable</c> record from the workflow context.
    ///
</summary>
    /// <param
name = “_context”>The workflow context.</param>
    ///
<returns>A <c>LedgerJournalTable</c> record.</returns>
    private LedgerJournalTable getLedgerJournalTableFromContext(WorkflowContext _context)
    {
        LedgerJournalTable ledgerJournalTable;
        if (_context.parmTableId() == tableNum(LedgerJournalTable))
        {
           
ledgerJournalTable =
LedgerJournalTable::findRecId(_context.parmRecId());
        }
        else if (_context.parmTableId() == tableNum(LedgerJournalTable))
        {
            ledgerJournalTable = LedgerJournalTrans::findRecId(_context.parmRecId(),
false).ledgerJournalTable();
        }
        return ledgerJournalTable;
    }
    ///
<summary>
    /// Validates
that the <c>WorkFlowContext</c> has the expected tables.
    ///
</summary>
    /// <param
name = “_context”>The workflow context.</param>
    ///
<returns>true if the expected tables are found; otherwise,
false.</returns>
    private boolean doesContextHaveExpectedTable(WorkflowContext _context)
    {
        return _context.parmTableId() == tableNum(LedgerJournalTable) || _context.parmTableId() == tableNum(LedgerJournalTrans);
    }
    public static FF_VendInvoiceWFParticipantProviderExpend construct()
    {
        return new FF_VendInvoiceWFParticipantProviderExpend();
    }
}

If your interested to know how it used to work in AX 2012, follow this link https://dynamicsnavax.blogspot.com/2009/12/ax-workflow-direct-approver.html

Share:

Related Posts

Microsoft Copilot
admin

Exploring Microsoft Copilot Architecture

Microsoft Copilot isn’t just another AI tool; it’s a comprehensive platform designed to be your indispensable companion, enhancing productivity, fostering creativity, and facilitating information comprehension all through a user-friendly chat interface. The concept of Copilot emerged two years ago when Microsoft introduced GitHub Copilot, aiming to assist developers in writing

Read More »
How to enable new Microsoft teams - Public Preview!
Microsoft Teams
Faisal Fareed

How to enable new Microsoft teams – Public Preview!

New Microsoft Teams is just AWESOME, quick but useful post below shows how you have this preview feature to make your life EASY!  Open Microsoft Teams admin center [Ask admin in your organization if you don’t have access] and follow path Teams > Teams update policies > Click on an existing

Read More »

Send Us A Message

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Post

Exploring Microsoft Copilot Architecture

Exploring Microsoft Copilot Architecture

Microsoft Copilot isn’t just another AI tool; it’s a comprehensive platform designed to be your indispensable companion, enhancing productivity, fostering creativity, and facilitating information comprehension all through a user-friendly chat interface. The concept of Copilot emerged two years ago when Microsoft introduced GitHub Copilot, aiming to assist developers in writing…

How to enable new Microsoft teams – Public Preview!

How to enable new Microsoft teams – Public Preview!

New Microsoft Teams is just AWESOME, quick but useful post below shows how you have this preview feature to make your life EASY!  Open Microsoft Teams admin center [Ask admin in your organization if you don’t have access] and follow path Teams > Teams update policies > Click on an existing…

Electronic Reporting: Send vendor payments to external azure storage via X++

Electronic Reporting: Send vendor payments to external azure storage via X++

Electronic Reporting module in Microsoft Dynamics 365 Finance Operation lets you archive file generated by ER at SharePoint location and in Azure Storage as per this link Archive ER destination type – Finance & Operations | Dynamics 365 | Microsoft Learn. APIs can be used to check message status and read…

FaisalFareed@2025. All rights reserved

Design by T3chDesigns