Announcements
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
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
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
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
You can set field mappings at the time of relationship creation.
Hi BobbyBoddu,
You can achieve this with JavaScript, Plugins, or Workflows.
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)
André Arnaud de Cal...
294,101
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator