How to get value from a lookup or other related entity using Calculated field in Microsoft Dynamics CRM

Did you ever need to get values from other entity or from a lookup on current entity? What comes to your mind, bet it is javascript , plugin etc?

Well, lets pause the coding life for minute and do it using Calculated Fields which used simple UI like business rules.

In Scenario below , i am retrieving the Budget Allocated amount from source campaign on a lead record.

  1. Create a currency Calculated field on lead record :1Give the appropriator name , select data type as Currency or as per your need > Select Field type as Calculated and click on Edit. As soon as you click on edit, system will actually create this field for you.
  2. After clicking on Edit button , you will be presented with the UI where you have put in  your logic:2
    As a first step i am checking if Budget Allocated field on campaign actually has data.To do this you have select Source campaign in the Entity and the corresponding field.
  3. Once this condition is set click on the Action :3
    In the editor start the typing the name of source campaign lookup or you can scroll though all fields/lookups available on the lead entity. Here i have select campaignid
  4. Once selected the campaignid , enter a dot(.) – post which you will start getting fields from the campaign:4
    Here i am selecting the budgetcost(Allocated Budget)
  5. Finally it will look like below :5Save and close the editor and also the field property window.
  6. Put this calculated field on the form and publish customization.
  7. Open a lead which has campaign associated to it:
    6campaign :
    7It is a very basic example i showed , i tried not to make it complex as it might become very confusing for a beginner.  You can do a lot manipulation with the data by using out of the box functions that are available for a calculated field or apply your custom logic.hope this helps!
    cheers!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.