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

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

(3) ShareShare
ReportReport
Posted on by 441
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,039 Super User 2025 Season 2 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
    179 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
    441 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,039 Super User 2025 Season 2 on at
     
    Can you explain your requirement in more detail? What do you want to achieve?
     
    Thanks,
    Waed Ayyad
  • D365FO Junior-Dev Profile Picture
    441 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
    300,917 Super User 2025 Season 2 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
    441 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
    300,917 Super User 2025 Season 2 on at
    That is great. Are you able to complete your customization?
  • Suggested answer
    Cyrille Nembot Profile Picture
    149 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
    237,807 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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans