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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM Form Customization

(0) ShareShare
ReportReport
Posted on by 360

I am trying to create a customized form in CRM where the population of one field will automatically trigger the population of another field based on the entity. For example, if the field is "country" and is set up as a lookup, I would like a following field called "region" to automatically populate based off the region I mapped each country to in the country entity I already created. What would be the easiest way to do this?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Hosk Profile Picture
    on at

    it depends what version of CRM you are using

    if you are using CRM 2013 then you could do this by Business Rules

    blogs.technet.com/.../crm-2013-understanding-portable-business-logic.aspx

    community.dynamics.com/.../dynamics-crm-2013-business-rules.aspx

    if you are using CRM 2011 then I would use Javascript (you can use this in CRM 2013 as well)

    www.renauddumont.be/.../CRM-2011-Dynamically-show-or-hide-fields-using-javascript

  • jeannie88 Profile Picture
    360 on at

    Thanks Ben! I am using CRM 2011. I don't necessarily need to hide the field though. I just want it to automatically populate so that there is no user error. Would that still be a javascript solution or would I be able to set up a workflow to accomplish this?

    Thanks,

    Jeannie

  • Suggested answer
    Hosk Profile Picture
    on at

    you wouldn't be able to do this using workflows because workflows are scheduled by CRM and there is not guarantee when they will run (it could be seconds/minutes)

    The best way to achieve this would be using Javascript because it needs to be instant.

    You can show and hide fields and set values using Javascript

  • Suggested answer
    Josh Thompson Profile Picture
    1,115 on at

    You will want to use REST to accomplish this in 2011. There are a ton of examples on the web, look for SDK.REST from the CRM SDK and give that a try. the method retrieveRecord is what you're probably looking for. If you are going against another lookup then you'll have to resolve those GUID's first.

    Here is a sample that returns the ID from a lookup field:

    function getLookupId(c) {

    //c = control name

    var lookupObject = Xrm.Page.getAttribute(c);

       if (lookupObject != null) {

           var lookUpObjectValue = lookupObject.getValue();

           if ((lookUpObjectValue != null))

           {

            //var lookuptextvalue = lookUpObjectValue[0].name;

            var lookupid = lookUpObjectValue[0].id;

           }

     }

    return lookupid;

    }

    Use the onchange event of the other control to start the process.

    HTH

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans