I am attempting to use the ribbon workbench and create a new "New" button and all is going fine except the JS.
So I am attempting to set several Lookup fields and cannot get it to work properly. If I do a single lookup it populates perfectly fine, I have tested with multiple fields but only one will fill in.
function newService_Button(){
var parameters = {};
parameters["formid"] = "GUID NUMBER GOES HERE";
if(Xrm.Page.getAttribute("cyb_poc") != null){
parameters["cyb_poc"] = Xrm.Page.getAttribute("cyb_poc").getValue()[0].id.slice(1,-1);
parameters["cyb_pocname"] = Xrm.Page.getAttribute("cyb_poc").getValue()[0].name;
parameters["cyb_poctype"] = "contact";
};
if(Xrm.Page.getAttribute("cyb_member") != null){
parameters["cyb_member"] = Xrm.Page.getAttribute("cyb_member").getValue()[0].id.slice(1,-1);
parameters["cyb_membername"] = Xrm.Page.getAttribute("cyb_member").getValue()[0].name;
parameters["cyb_membernametype"] = "cyb_member";
};
if(Xrm.Page.getAttribute("cyb_loa") != null){
parameters["cyb_loa"] = Xrm.Page.getAttribute("cyb_loa").getValue()[0].id.slice(1,-1);
parameters["cyb_loaname"] = Xrm.Page.getAttribute("cyb_loa").getValue()[0].name;
parameters["cyb_loatype"] = "cyb_loa";
};
Xrm.Utility.openEntityForm("cyb_service", null, parameters);
}
All the code works and pulls the information, but doesn't populate on the new form, just one of the lookup fields.