i have 2 entities (opportunity and Caution),i need to pass values from opportunity to caution (opportunity subject, value and date)i developed 2 functions :
function GetValues(){ // call this function when the opportunity forms saved // get opportunity name var opportunityID = Xrm.Page.data.entity.getId(); var opportunityEntityType = Xrm.Page.data.entity.getEntityName(); var opportunityName = Xrm.Page.data.entity.attributes.get("name").getValue(); var extraqs = "new_nameid="+opportunityID+""; extraqs += "&new_namename="+opportunityName+""; extraqs += "&new_nametype="+opportunityEntityType+""; var features = "location=no,menubar=no,status=no,toolbar=no"; var newWindow = window.open("/main.aspx?etn=new_marchepublic&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs), "_blank", features, false); newWindow.resizeTo(690, 699); }
function setCautionValue(context){ // call this function On Load caution entity try{ var extraqs = context.getQueryStringParameters(); console.log("params: ",extraqs); if(extraqs != null){ var lookupName = new Object(); lookup.id = extraqs["new_nameid"]; lookup.name = extraqs["new_namename"]; lookup.entityType = extraqs["new_nametype"]; Xrm.Page.getAttribute("new_name").setValue([{ id:extraqs["new_nameid"], name:extraqs["new_namename"], entityType: extraqs["new_nametype"] }]); } }catch(e){ console.log("error: ",e.message); } }
new_nameid, new_namename and new_nametype defined in forms property as parameter, but always i show the same problem
*This post is locked for comments