Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Calculated field between two entities

Posted on by 62

I have two different entities in CRM and have to find a difference between date present in one entity and date present in another entity.

I tried using calculated column but the field's schema name from another entity is not showing up in formula.

Can anyone help me out how to achieve this?

FYI

Entity 1: Rebate & Approvals, Field - Sales Delivery Committed Date

Entity 2: OFG Data, Field - NWC Invoice Date

Calculated Field: Diff b/w committed and Invoice date

pastedimage1667969996802v1.png

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Calculated field between two entities

    Hi,

    Please validate of javascript syntax is correct.

    esprima.org/.../validate.html

    Please share screenshot of your event handler

  • Rajath Krishna S Profile Picture
    Rajath Krishna S 62 on at
    RE: Calculated field between two entities

    I have used jScript to find number of days between two dates. But I am getting error as "Web resource method does not exist". 

    I have tried all the ways to fix. Can anyone help?

    function datediff(){
    var d1=crmForm.all.FirstDate.DataValue;
    var d2=crmForm.all.SecondDate.DataValue;
    var DayValue=1000*60*60*24;
    alert(Math.ceil((d2.getTime()-d1.getTime())/DayValue));
    var d1=Xrm.Page.getAttribute(“new_salesdeliverycommitteddate").getValue();
    var i= Xrm.Page.getAttribute(“new_numberofdocumentsofnwc").getValue();
    var d2=Xrm.Page.getAttribute(“new_nwcinvoicedate”+i).getValue();
    var DayValue=1000*60*60*24;
    var diff = Math.ceil((d2.getTime()-d1.getTime())/DayValue);
    Xrm.Page.getAttribute(“new_diffbwcustomerdelivery_invoicedate").setValue(diff);
    }

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Calculated field between two entities

    Hi,

    You can use data from Lookup records within your Action. You first have to select the Lookup field and then type a period. After that, you can select one of the fields available on the related entity. For example, in the case of <LookupFieldName>.<RelatedFieldName>, you can select: ParentAccountId.AccountNumber.

    Note that field level security will be ignored on the related entity, so if there is sensitive data in the accessed field we suggest securing your calculated field as well.

    learn.microsoft.com/.../define-calculated-fields

    This will only work when you have relationship defined between two entities.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans