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 :
Microsoft Dynamics CRM (Archived)

Comparing two values from different entites

(0) ShareShare
ReportReport
Posted on by 10

I would like to compare two values and display the highest value.

The values are from two different customers within the contact entity and i would like to display the highest value in a separate entity called account.  

Scenario.

------------------ Contact Entity -------------------

Customer1 = John

Account value = $300

Customer2 = Sally

Account value = $400

------------------ Account Entity ------------------------

Shared account

lookup = Customer1

lookup = Customer2

Display highest account value = $400

Not sure of the best way of approaching this.

Thank you in advance for your help.

 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Comparing two values from different entites

    I would use calculated field.  Create field on account entity 'Highest Account Value' - currency field of type Calculated.

    You can add the condition that will show highest value between the two contact records.

    You could achieve this also with workflow - which would be updated behind scenes and may not be ideal.

    Create new field on Account - Highest account Value

    Workflow - trigger when Customer 1 or 2 changes

    Check if Customer 1 (Account Value) is greater than Customer 2 (Account Value)

    If yes Then update 'Highest Account Value' = Customer 1 (account Value)

    If no Then update Highest Account Value = Customer 2 (account value)

    In some situations you could use a 'Real Time Workflow' and this would update upon save and refresh real time to end user.

    Otherwise you could build same logic with some javascript.

  • Suggested answer
    CRM Konrad Profile Picture
    on at
    RE: Comparing two values from different entites

    If you need to do this in the configuration layer, not with programing, and your customer fields on the account really are lookups (not a subgrid/1toN) then you could look into a workflow where you do an if then comparing the two regarding entity values or if use and "Action" step process and have it part of a workflow step on the account entity.  crmtipoftheday.com/.../tipster-guide-to-dynamics-crm-custom-actions

    You should be able to get the two values as input variables then do some "if then" on the values and assign the display highest value as an output and update the Account record with it.  

    The trick will be your "on change" event is on the Contact, a step removed, so you'd need another workflow that checks off a Boolean on the related account on change on the contact to fire the workflow to "do recalc" of the comparison.

    I'm not confident on a calculated field you can compare values on two different lookup records one step removed.

  • ChristopherFernando Profile Picture
    95 on at
    RE: Comparing two values from different entites

    Hello WiselyUK,

    Is there always going to be only two customers per account?  Or are you using the native Account to Contact relationship (one account to many customers)?

    It looks like you're using CRM 2013, which does not have calculated fields nor rollup fields.

    You may be able to do this with a few workflows, but it depends on the details of the use of this field.

    Can you describe how it is used?  What is the data structure related to this field?  How often is this data changed?  Are contact deleted?

    The more detail about the requirements you provide the better the solution you may recieve.

    I'm looking forward to helping out.

    Thanks!

    -Chris

  • Suggested answer
    Sayhaitokumar Profile Picture
    7,042 on at
    RE: Comparing two values from different entites

    Hi,

    I suggest you to use calculated field

    To know more about that see the below blog

    technet.microsoft.com/.../dn832103.aspx

    www.powerobjects.com/.../calculated-fields-in-dynamics-crm-2015

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans