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 show display method fields on workflow configuration?

(0) ShareShare
ReportReport
Posted on by 185

Hi I am created a workflow for sales order (Custom workflow) which I have created successfully, now I am configuring my workflow and I have to use the field Estimated Margin%  in the conditional statement of workflow configuration as shown in the below screenshot

2022_2D00_06_2D00_20_5F00_14_2D00_14_2D00_17.png

I am using a query that is returning all the SalesTable and SalesLine fields except the fields that are using the display method and this estimated margin is also a display method(OOB) created in form datasource as shown in the below screenshot

2022_2D00_06_2D00_20_5F00_14_2D00_21_2D00_34.png

2022_2D00_06_2D00_20_5F00_14_2D00_22_2D00_18.png

How can I get this field in workflow configuration, Thanks.

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,082 Most Valuable Professional on at

    You can add methods to the workflow document class.

    For example, look at parmCalcTotalMiscCharges() in PurchTableDocument class.

  • bilal170795 Profile Picture
    185 on at

    Hi Martin,

    Thanks for the response, I tried to add my field in a similar manner but am still unable to see my field maybe it will come with the different name I am sharing my code and the area where I am trying to find my field, so you can have a better insight

    2022_2D00_06_2D00_20_5F00_22_2D00_30_2D00_26.png

    2022_2D00_06_2D00_20_5F00_22_2D00_29_2D00_34.png

    class XYZ_SalesTableWorkflowTypeDocument extends WorkflowDocument
    {
        SalesTable                      salesTable;
        SalesLine                       salesLine;
    
        /// 
        /// Returns query name for the workflow document.
        /// 
        /// 
        /// Name of the query XYZ_SalesTable.
        /// 
        public queryName getQueryName()
        {
            return querystr(XYZ_SalesTable);
        }
    
        public Percent MarginPercentStr(CompanyId _companyId, TableId _tableId, RecId _recId)
        {
            Percent margin;
            salesTable = this.getSalesTable(_recId);
            
            select salesLine 
                where salesLine.SalesId == salesTable.SalesId;
    
            margin = salesLine.McrMarginPercent;
    
            return margin;
    
        }
    
        private SalesTable getSalesTable(RecId  _recId)
        {
            if (!salesTable)
            {
                salesTable = salesTable::findRecId(_recId);
            }
    
            return salesTable;
        }
    
    }

  • Martin Dráb Profile Picture
    239,082 Most Valuable Professional on at

    Try respecting the naming convention - call the method parmMarginPercentStr() instead of MarginPercentStr().

    I'm not sure if it'll make a difference, but I have a feeling that the framework really looks just for methods prefixed with "parm".

    By the way, are you sure that you want to use a value from a SalesLine without specifying which one? You leave the selection to the database server and if not all lines have exactly the same value of McrMarginPercent, you can't be sure which one you'll get. It looks like a bad design to me. I would look again at the actual business requirement...

  • bilal170795 Profile Picture
    185 on at

    Hi Martin,

    Thanks for pointing out yes you are right about SalesLine value. So I would like to give more brief details about the business requirement that I am configuring the workflow and in this workflow, I have to put some conditional statements on the basis of the values of Estimated margin% but when I am looking it in the list of field I am unable to find it, the list I show you in the previous post. Moreover, I would like to tell you what I found while digging is that my datasource in query has the value of MCRMarginPercent(i.e; Estimated margin) but the list is not showing the respective field, previously I thought it could be due to the reason of display method but this field exist in the database.

    2022_2D00_06_2D00_21_5F00_2_2D00_10_2D00_28.png

    2022_2D00_06_2D00_21_5F00_2_2D00_16_2D00_29.png

  • Martin Dráb Profile Picture
    239,082 Most Valuable Professional on at

    Do you realize that the workflow document you're using is about the whole order, but field isn't on purchase order header (PurchTable)? It's on the line (PurchLine). You either need a value aggrgated for all lines lines, or you need to use a line-level workflow. It depends on business requirements; unfortunately your description above doesn't cover this topic.

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 March 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 653

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 317 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans