Hello friends,
I am new to Dynamics 365 CRM 2016,
i have few query
1. how to get value in lookup field from different entity.
this is my code.
function createOpp() {
debugger;
try {
if (Xrm.Page.ui.getFormType() == 2) {
// testing area
//Create Entity
var entity = new XrmServiceToolkit.Soap.BusinessEntity("sss_oppurtunityapp");
//String
entity.attributes["sss_name"] = Xrm.Page.getAttribute("sss_topic").getValue();
// Xrm.page.getattribute("sss_twoopp1").setvalue(1);
Xrm.Page.getAttribute("sss_twoopp1").setValue(1);
var accentity = new XrmServiceToolkit.Soap.BusinessEntity("account");
accentity.attributes["name"] = Xrm.Page.getAttribute("sss_company").getValue();
//accentity.attributes["sss_salesstage"] = Xrm.Page.getAttribute("processstage_category").setValue(0);
var quoteId;
quoteId = XrmServiceToolkit.Soap.Create(entity);
var accountID;
accountID = XrmServiceToolkit.Soap.Create(accentity);
entity.attributes['sss_account'] = { id: Xrm.Page.getAttribute("quoteId").getValue()[0].id, logicalName: Xrm.Page.getAttribute("account").getValue()[0].entityType };
// entity.attributes['sss_account'].setValue([{ id: accountID, entityType: account }]);
// Xrm.Page.getAttribute("sss_account").setValue([{ id: accountID, entityType: account }]);
Xrm.Utility.openEntityForm("sss_oppurtunityapp", quoteId)
}
}
catch (Exception) {
alert(Exception.message);
}
}