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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to get the list of all workflow outcomes in X++?

(3) ShareShare
ReportReport
Posted on by 532
Hi Everyone,
How can I retrieve the list of workflow outcomes shown in the attached image using X++ to retrieve the workflow outcomes for a specific MenuItem?
For example I want to get a list of all outcomes that are already enabled in the workflow editor for the MenuItem TrvExpenses.
Thank you

I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
     
    Do you want to work on the handler classes of the workflow? In general, you can check the approval that is connected to the workflow type and see all the workflow actions added to the workflow approval.
     
     
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

  • Syed Amir Ali Profile Picture
    213 on at
    Hi, Would you like to receive the list of workflow tasks assigned to you? I'm not entirely sure what you're requesting—could you please clarify your requirement a bit more?
  • D365FO Junior-Dev Profile Picture
    532 on at
    Hi Everyone:

    Thank you for your answers. I meant using X++ to retrieve these actions that are enabled in the workflow editor.

  • Waed Ayyad Profile Picture
    9,135 Super User 2026 Season 1 on at
     
    Can you explain your requirement in more detail? What do you want to achieve?
     
    Thanks,
    Waed Ayyad
  • D365FO Junior-Dev Profile Picture
    532 on at
    Hi @Waed Ayyad :

    Norrmaly I want to get these outcomes, for example print them in RunableClass using x++.
  • André Arnaud de Calavon Profile Picture
    305,150 Super User 2026 Season 1 on at
    Hi D365FO Junior Dev,
     
    You can reverse engineer the current logic being executed when you click on the Workflow button. Then you can find the example how to find the relevant actions. 
  • Suggested answer
    D365FO Junior-Dev Profile Picture
    532 on at
     
    Hi there,

    Thanks for you help and your suggestions I found this snippet code I thing it would help me.
     
    public static List findWorkflowItemOutcomes(Guid _workflowItemId)
    {
        WorkflowWorkItemTable workflowItem;
        WorkflowElementTable elementTable;
        SysWorkflowElement sysWorkflowElement;
        List outcomeList = new List(Types::String);
    
       
        select firstOnly workflowItem
        where workflowItem.Status == WorkflowWorkItemStatus::Pending
           && workflowItem.Id == _workflowItemId;
    
        if (workflowItem.RecId)
        {
         
            elementTable = workflowItem.workflowElementTable();
    
       
            sysWorkflowElement = SysWorkflowElement::newElementTable(elementTable);
    
         
            outcomeList = sysWorkflowElement.getOutcomes();
             
        }
    
        return outcomeList;
    }
     
  • André Arnaud de Calavon Profile Picture
    305,150 Super User 2026 Season 1 on at
    That is great. Are you able to complete your customization?
  • Suggested answer
    Cyrille Nembot Profile Picture
    151 on at
    If that code does not work, this one will definitely work:
     
    public static void getWorkflowOutcomesForMenuItem(MenuItemName _menuItemName)
    {
        WorkflowTypeTable       workflowTypeTable;
        WorkflowVersionTable    workflowVersionTable;
        WorkflowStepTable       workflowStepTable;
        WorkflowStepOutcome     workflowStepOutcome;
        
        // Find the active workflow configuration for the specified menu item
        select workflowTypeTable 
            where workflowTypeTable.TypeName == _menuItemName
            join workflowVersionTable
                where workflowVersionTable.WorkflowType == workflowTypeTable.RecId &&
                      workflowVersionTable.IsActive;
        
        if (workflowTypeTable.RecId)
        {
            info(strFmt("Workflow outcomes for %1:", _menuItemName));
            
            // Get all steps for this workflow
            while select workflowStepTable
                where workflowStepTable.WorkflowVersion == workflowVersionTable.RecId
                join workflowStepOutcome
                    where workflowStepOutcome.WorkflowStep == workflowStepTable.RecId
            {
                info(strFmt("- %1", workflowStepOutcome.Name));
            }
        }
        else
        {
            info(strFmt("No workflow configuration found for %1", _menuItemName));
        }
    }
  • Martin Dráb Profile Picture
    239,632 Most Valuable Professional on at
    @Cyrille Nembot Please tell us more about WorkflowStepOutcome table. As far as I know, such a table doesn't exist in F&O? How did you test your claim that "this one will definitely work"
    I suspect you just copied an answer that AI made up, without any verification that it made sense and it could a useful contribution to this forum. Please stop that; follow Responsible AI policies of this forum.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 804

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 639 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 528

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans