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
All values verified.
yes the second entity "Caution" but the schema name : new_marchepublic
Hi,
To troubleshoot this issue you may do following
1. Add javascript alerts in each block of function and check whether the query string parameters are getting populated or not, & lookup exists etc.
2. If any alert shows "undefined" then that needs to be fixed.
3. var newWindow = window.open("/main.aspx?etn=new_marchepublic&pagetype=entityrecord&extraqs=" +
Is "etn" value pointing correct entity? As you said the second entity is "caution".
If my response helps you, please mark it as "Verified"
Best Regards,
Abhishek
Hi Ammar.,
You should open the log file to know the exactly reason.
Regards,
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156