Description:
In this example we explain that how to populate Quick create from with data from parent form in Dynamic CRM using JavaScript. Or how to set Parent Case Lookup in Quick Create case form in Dynamic CRM using JavaScript. Or how to pre-fill fields in a quick create form from the parent form using JavaScript in Dynamic CRM.
Here we demonstrate
that how to populate a parent form lookup field value in a child form using
JavaScript in Dynamic 365.so how to fill-up the Parent Case Lookup in Child
case form using JavaScript in Dynamic CRM.
function SetQuickCreateForm() {
if
(Xrm.Page.getControl("header_process_new_isfuturecorrectiveactionrequired").getAttribute().getText()
== "Yes") {
var
TM_Id = Xrm.Page.data.entity.getId();
var
TM_EntityName = Xrm.Page.data.entity.getEntityName();
var
TM_Name = Xrm.Page.getAttribute("title").getValue();
var
parentAccount = { entityType: "incident",
id: TM_Id };
var
parameters =
{
description: Xrm.Page.getAttribute("description").getValue(),
title: Xrm.Page.getAttribute("title").getValue(),
new_parentcaseid: TM_Id,
new_parentcaseentityname: TM_EntityName,
new_parentcasename: TM_Name
};
Xrm.Utility.openQuickCreate("incident", parentAccount,
parameters).then(function (lookup) {
successCallback(lookup); }, function (error) {
errorCallback(error); });
}
}
function
successCallback(lookup) {
alert("lookup:
" + lookup.savedEntityReference.id);
alert("lookup:
" + lookup.savedEntityReference.name);
}
function
errorCallback(e) {
//
*** No new contact created, which is an error we can ignore!
alert("Error:
" + e.errorCode + " " +
e.message);
}
0 comments:
Post a Comment