Hi Guys,
I copied Appointment button and placed on my Custom Entity. Now onClick of Appointment button i should update appointment record with custom entity values.
I'm only getting Regarding filled populated (which is Lookup) and if i place lookup in comments then remaining fields are populating.
How to set both
Here is my code
function createAppontment()
{
debugger;
var windowOptions = {openInNewWindow: true};
var entityId = Xrm.Page.data.entity.getId().replace("{","").replace("}","");
var entityName = Xrm.Page.getAttribute("new_name").getValue();
var entityType = Xrm.Page.data.entity.getEntityName();
var phone = Xrm.Page.getAttribute("new_phonenumber").getValue();
var parameters = {};
//setLookUp value
parameters["regardingobjectid"] = entityId;
parameters["regardingobjectidname"] = entityName;
parameters["regardingobjecttypecode"] = entityType;
parameters["new_appointmenttype"] = "100000001"; // static values
parameters["new_source"]= "100000000"; // static values
parameters["new_phonenumber"] = phone; // retrieved from custom entity
Xrm.Utility.openEntityForm("appointment", null,parameters,windowOptions);
}