Hi Darshani,
I managed to get it working for a lookup from the Invoice entity and opened the contact form by using this code:
function openContactForm() {
var parameters = {};
parameters["jobtitle"] = "IT Manager";
var customer = Xrm.Page.getAttribute("customerid").getValue();
if (customer != null) {
var customerId = customer[0].id;
customerId = customerId.replace('{', '').replace('}', '');
parameters["parentcustomerid"] = customerId;
parameters["parentcustomeridname"] = customer[0].name;
parameters["parentcustomeridtype"] = "account";
Xrm.Utility.openEntityForm("contact", null, parameters, true);
}
}
So the customerid field is from the Invoice record and the parentcustomerid field is on the contact record.
From reading a few posts online I think you need to change your function to this:
function OpenMemberCallNote() {
alert("Opening Member Call note Form");
var parameters = {};
var callnote = Xrm.Page.getAttribute("pomco_callnote").getValue();
parameters["pomco_callnote"] = callnote;
var Provider = Xrm.Page.getAttribute("pomco_provider").getValue();
if (Provider != null) {
var ProviderId = Provider[0].id;
ProviderId = ProviderId.replace('{', '').replace('}', '');
parameters["pomco_providerid"] = ProviderId;
parameters["pomco_provideridname"] = Provider[0].name;
Xrm.Utility.openEntityForm("pomco_membercallnote", null, parameters);
}
}
The following line is not needed if the lookup is for a single entity:
parameters["pomco_provideridtype"] = Provider[0].entityType;
The reason I needed it in my function is that the parentcustomerid can be an Account or a Contact
Hope that helps
Bharat