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

Data Entity Creation where does the Margin field live?

(1) ShareShare
ReportReport
Posted on by 131
OHello,
 
In D365 F and O I wish to create a Data Entity.  I know how to do this, but I specifically require the Margin field within the Invoice Journal screen.
 
I went into the Form Information screen and can see the Control Name is 'Contribution Margin' and the Data Source is 'CustInvoiceTrans', however, if perform a SQL lookup in this table, there is no ''Contribution Margin' field.
 
Where does the Margin field live or is it calculated on-the-fly?  If so what is the calculation?
 
Thank you,
 
Michael
  • Layan Jwei Profile Picture
    7,788 Super User 2025 Season 1 on at
    Data Entity Creation where does the Margin field live?
    Hi Michael,

    There is no such field, could it be a customized field?

  • Verified answer
    Michael Hutcheson Profile Picture
    131 on at
    Data Entity Creation where does the Margin field live?
    Hi all,
     
    I found what I was looking for - it is this Entity:
     
    Entity:                   Pending and active item prices V3
    Staging Table:      InventItemPriceV3Staging
    Target Entity:        InventItemPriceV3Entity
     
    There is a column within the Entity called [AVERAGEUNITCOST] - this is the cost used to calculated the Margin for Invoiced Order Lines.
  • Layan Jwei Profile Picture
    7,788 Super User 2025 Season 1 on at
    Data Entity Creation where does the Margin field live?
    Hi,

    Is your issue question answered? if yes, then please verify the answers that helped.

    Thanks,
    Layan Jweihan
  • Layan Jwei Profile Picture
    7,788 Super User 2025 Season 1 on at
    Data Entity Creation where does the Margin field live?
    Hi,

    I don't think it's stored anywhere since it requires calculation.  I just looked at the method and it seems very complex, I don't think computed column would work, you can look at the code inside the display method. So it seems you will need to go with the virtual field  -- and you can see how the performance of the entity will be affected (I mean if it's ok with you or not)



    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Michael Hutcheson Profile Picture
    131 on at
    Data Entity Creation where does the Margin field live?
    Hi,
     
    Thanks for that, that is a big help.
     
    Is the actual calculation for the Margin field stored anywhere?  I can write T-SQL but how do I know what to replicate?
     
    Regards,
     
    Michael
  • Suggested answer
    Layan Jwei Profile Picture
    7,788 Super User 2025 Season 1 on at
    Data Entity Creation where does the Margin field live?
    Hi Michael,

    This margin field is a display method in CustInvoiceTrans table. In order to add it to the entity, you will need to use computed columns or virtual fields.

    You can check this link for more details:
    https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/data-entity-computed-columns-virtual-fields


    So you need to look at the logic of this display method, if you can write it in T-SQL then use computed columns. If not then use virtual fields. With virtual fields you can use x++ coding and call the display method but virtual fields cause performance issues that's why we prefer to use computed columns if it's possible to use them

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,459 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,066 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans