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)

Updating a field automatically

(0) ShareShare
ReportReport
Posted on by 479

Hi,

I have got a couple of fields in my Contacts that I would like to link to each other, but only if certain conditions are met.

So for example, if someone has a certain email domain in the email field in Contacts, I want this address to be automatically added to another field in Contacts. I have created a business process to do this but it doesent seem to be working.

Should I use w workflow or is there a simpler method?

Thanks as always.

*This post is locked for comments

I have the same question (0)
  • Priyesh Profile Picture
    7,396 User Group Leader on at
    RE: Updating a field automatically

    Hi,

    You can use Business Rules to do this. However, can you tell me where you have specified the domain that a certain email address should match?

    Also, can you share your business process that you mention?

    Thanks.

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at
    RE: Updating a field automatically

    Hi There,

    You can very well utilize business rule to achieve this , all you have to do is to check if email address field contains "the domain" you can then set other values based on this.

    disadvantage - it will trigger everytime you load the form and also save it.

    other options

    1. create a javascript , check the formtype if you just need on update form ( check the form type i.e as 1 or 2) then perform operations , call the function on onload of the function.

    2. you can use workflow for that - call the workflow on create or update of the required with required condition.

    basically it depends on your requirement and business preference.

  • Suggested answer
    Seren S Profile Picture
    402 on at
    RE: Updating a field automatically

    Business rules can be insufficient to validate fields in detail before mapping. It has limited functionalities to use.

    If it is not fulfilling your requests, the javascript is the simple way to handle in detail.

    You can find the regarding library and its functions from here (e.g. getValue, setValue): https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes

    Hope it helps.

    Cheers, Seren.

  • Suggested answer
    FabioG Profile Picture
    130 on at
    RE: Updating a field automatically

    with javascript you can add an onchange methods to retrieve a domain

    var email = formContext.getAttribute("email").getValue();

    var domain = email.substring(email.lastIndexOf("@")+1).substring(0, email.indexOf("."));

    if (domain === "domain-you-need")

    {

    formContext.getAttribute("fields-you-need-to-change").setValue(true);

    }

    Obviously this code is just a draft for what you need but can be a good start for what you are looking for

  • LuHao Profile Picture
    40,890 on at
    RE: Updating a field automatically

    Hi Ted,

    I think using business rule should solve your problem.

    Please note that you need to add a business rule to the Contact entity instead of adding it to the Email field.

    5074.1.JPG

    The business rule is set as follows:

    IF
    Email contains "email domain"
    THEN
    Set Email to Email Address 2

    5074.1.JPG

    Hope this helps.

    Best Regards,

    Lu Hao

  • Suggested answer
    Sreevalli Profile Picture
    3,256 on at
    RE: Updating a field automatically

    Hi,

    If you are talking about workflow process then it will trigger after save. (you have to refresh if it is background process).

    or if you want to see the changes immediately after the email update then you should go for Business Rule or JavaScript.

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 > 🔒一 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