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, ...
Answered

How to make Data entity's field from a method with parameter

(0) ShareShare
ReportReport
Posted on by 709

Hello guys,

Need some help for creating a data entity, it is for export to BYOD and related to table ProjInvoiceJour. 

So I notice in ProjInvoiceJour table there is no field InvoiceAmountMST and I need this field to be exported as well to my BYOD. I have created the data entity but now its field only contain the table original field. Notice in the method of ProjInoviceJour there is one method for calculate AmountMST but it is requires a parameter which is the InvoiceAmount. ->

pastedimage1634523914584v1.png

pastedimage1634523983432v2.png

How to use this method to make my data entity has a field with the result of that calculation, I know the parameter will be retrieved from InvoiceAmount field in ProjInvoiceJour, but I don't know how to make it as a display field in data entity.

Thanks

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

    If you have no idea how to do it, it's time to look into documentation: Computed columns and virtual fields in data entities.

    If you want to use CurrencyExchageHelper, you need a virtual field. If you wanted to use a computed column, you'd have to rewrite the logic to T-SQL (which doesn't look like a good idea in this case).

    I'm assuming that you have InvoiceAmount in your entity, and this field will be the input for the calculation.

  • ShaqAX Profile Picture
    709 on at

    Hi Martin,

    Thanks for the advice. I create this method. should be sufficient as I tested.

    public static server str InvoiceAmountMST()

       {

           str InvoiceAmountField = SysComputedColumn::returnField(

               tablestr(XYZProjInvoiceHeaderEntity),

               identifierStr(ProjInvoiceJour), fieldStr(ProjInvoiceJour,InvoiceAmount));

           str ExchangeRateField = SysComputedColumn::returnField(

               tablestr(XYZProjInvoiceHeaderEntity),

               identifierStr(ProjInvoiceJour), fieldStr(ProjInvoiceJour, ExchRate));

           return strFmt('%1 * isnull(%2,100)/100', InvoiceAmountField, ExchangeRateField);

       }

    Regards,

  • Verified answer
    Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    It looks good, if you don't need all the other logic of CurrencyExchangeHelper::mstAmount().

    Just please always use Insert > Insert Code (in the rich-formatting view) to paste source code:

    public static str invoiceAmountMST()
    {
    	str invoiceAmountField = SysComputedColumn::returnField(
    		tableStr(XYZProjInvoiceHeaderEntity),
    		identifierStr(ProjInvoiceJour), fieldStr(ProjInvoiceJour,InvoiceAmount));
    	   
    	str exchangeRateField = SysComputedColumn::returnField(
    		tableStr(XYZProjInvoiceHeaderEntity),
    		identifierStr(ProjInvoiceJour), fieldStr(ProjInvoiceJour, ExchRate));
    	   
    	return strFmt('%1 * isnull(%2,100)/100', invoiceAmountField, exchangeRateField);
    }

    By the way, I threw away the server keyword, because it doesn't have any effect in F&O. There is no X running on client anymore.

  • Marwa El Sawah Profile Picture
    5 on at

    Hello,

    How did you find ProjInvoiceJour at the data entity creation wizard? I couldn't find it.

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 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans