Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get data from one entity another another entity based select field

(0) ShareShare
ReportReport
Posted on by

Hi,

    I have created two entities one Branch and Customer entities. I will select branch id in customer form then branch entity related fields are updated in Customer form by default

   

*This post is locked for comments

  • Verified answer
    gdas Profile Picture
    50,089 Moderator on at
    RE: Get data from one entity another another entity based select field

    Hi ,

    Creating additional fields for branch information in customer entity not only increase your additional work but also increase cost and efforts . In this case every create/Update branch information you need to handle in customer entity fields as well. This is why Quick View Form is introduced , you can easily show real time  data of related  entity using lookup id.

    Just think  , why you are doing  additional customization and maintain same data in two different entity ? You just refer the quick view forms of branch in your customer form. I know this is hard to change your current design , but why not you are  upgrade and use the OOB (without code ) quick view form feature.

    Above Alex is already shared the link of quick view form , in addition I am also sharing another link to understand more.

    www.websan.com/.../720-create-d365-quick-view-forms-in-3-easy-steps

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,235 on at
    RE: Get data from one entity another another entity based select field

    Hi,

    I believe you are working dynamics 365 9.0 version and as you queried the answer is straight forward. You can use Xrm webApi to retrieve and set data on customer entity.

    Please do refer following url for reference.

    arundynamix.blogspot.com/.../xrmwebapi-call-synchronous-in-v9.html

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Get data from one entity another another entity based select field

    Hi,

    if the branch id in customer form is a lookup control.

    You also can consider the Quick view Form.

    www.magnetismsolutions.com/.../how-to-add-a-quick-view-form-in-microsoft-dynamics-365

  • Suggested answer
    Ashutosh Pandey Profile Picture
    40 on at
    RE: Get data from one entity another another entity based select field

    You can set field mappings at the time of relationship creation.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,023 Super User 2025 Season 1 on at
    RE: Get data from one entity another another entity based select field

    Hi BobbyBoddu,

    You can achieve this with JavaScript, Plugins, or Workflows.

  • Community Member Profile Picture
    on at
    RE: Get data from one entity another another entity based select field

    I will tried to this code.

    function getBranchdetails()

    {

    var Lookup=Xrm.Page.getAttribute("parentcustomerid").getValue();

    var id=Lookup[0].id;

    alert(id);

    var req = new XMLHttpRequest();

    req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/sbl_branchs(guid""+id"")?$select=sbl_branch_name,sbl_branchid,sbl_name&$count=true", true);

    req.setRequestHeader("OData-MaxVersion", "4.0");

    req.setRequestHeader("OData-Version", "4.0");

    req.setRequestHeader("Accept", "application/json");

    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    req.setRequestHeader("Prefer", "odata.include-annotations=\"*\",odata.maxpagesize=5000");

    req.onreadystatechange = function() {

       if (this.readyState === 4) {

           req.onreadystatechange = null;

           if (this.status === 200) {

               var results = JSON.parse(this.response);

               var recordCount = results["@odata.count"];

               for (var i = 0; i < results.value.length; i++) {

                   var b_name = results.value[i]["sbl_branch_name"];

                    Xrm.Page.getAttribute("sbl_branch_name").setValue(b_name);

               }

           } else {

               Xrm.Utility.alertDialog(this.statusText);

           }

       }

    };

    req.send();

    }

    But i have an error.

    Script Error

    One of the scripts for this record has caused an error. For more details, download the log file.

    ReferenceError: getBranchdetails is not defined at eval (eval at RunHandlerInternal (skbsolution.crm8.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:1)

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,101 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans