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)

Using dynamic values for related entities in 'Set field value' action using Business Rules

(0) ShareShare
ReportReport
Posted on by 676

Say I am on case form:
Using business rules I have noticed that there's an action "Set a field value". How can we set field values based on certain conditions dynamically?
For example, if invoice search (invoice search is a field on phone to case process) contains data --> Set customer name accordingly (related to that invoice, if such invoice already exists because customer and invoice have 1 to many relationship).
 It isn't documented much about business rules but I read in another post that we can use related entities using dot notation. But in this case can't I use this set value as field 'customerid.name'  ? (set customer's name which is related to that invoice. ).
It doesn't allows me to enter any dot notation rather asks me to pick up a lookup value. Undoubtedly business rules will save a lot of time, so any help would be highly appreciated.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    tw0sh3ds Profile Picture
    5,600 on at
    RE: Using dynamic values for related entities in 'Set field value' action using Business Rules

    Hi,

    Basically you have to retrieve related account on invoice using WebApi:

    msdn.microsoft.com/.../mt607871.aspx

    now you just have to set the value of the field you like with the retrieved name of the account:

    Xrm.Page.getAttribute(“attributename”).setValue(‘YourValue’);

    If you never wrote any JS customization in CRM, you should first see some tutorials. I will not paste here anything I can recommend, because I never used a tutorial for that, but when you google CRM 2016/Dynamics365 Javascript tutorial you will get plenty of them that will point you to the right direction.

  • Mohd Tahir Profile Picture
    676 on at
    RE: Using dynamic values for related entities in 'Set field value' action using Business Rules

    Hi Pawel,

    Thanks for your reply. Any suggestion how I could achieve this using JavaScript? I am actually new to CRM dynamics and prior to this I had been working on SharePoint.

  • Suggested answer
    tw0sh3ds Profile Picture
    5,600 on at
    RE: Using dynamic values for related entities in 'Set field value' action using Business Rules

    Hi,

    It's not true about this "dot notation", I don't know where you've got this information. You can use this notation when you are creating calculated fields, not Business Rules. Setting a value is simply setting hardcoded value in this case, no dynamically computed data. If you want to do something more sophisticated you sohuld use Javascript instead of Business Rules.

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at
    RE: Using dynamic values for related entities in 'Set field value' action using Business Rules

    Hi Mohd Tahir,

    It is not possible to set the field value of related entities using business rules. Business Rules only let you work with local entity fields in the definition of the business logic. In other words, if your business logic will require any data from a parent entity or any related entity (through a lookup field) then you will need to use a javascript function, most likely using Odata, to read the related entity and perform the business logic. This is one of the limitation of business rule.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans