web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Calculated field between two entities

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator 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.

  • Rajath Krishna S Profile Picture
    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
    28,983 Moderator 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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 117 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 115

#3
Erin Lubben Profile Picture

Erin Lubben 66

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans