I have a custom entity linked to a case in my CRM solution. From a control on the case page I want to create a new instance of that custom entity linked to the current case. So far I have ...
function post_update() { var caseaction = {}; // new object for case action caseaction.new_name = "Case action " + $('#updateaction option:selected').text(); var caseid = $('#caseid').val(); alert(caseid); caseaction.new_testmodule_case = { Id: caseid, LogicalName: "incident", Name: "Name" }; // will that work? var actionid = $('#updateaction').val(); alert(actionid); caseaction.new_testmodule_caseaction = { Value: actionid }; var ConfirmMessage = "Case updated"; //Create the object SDK.REST.createRecord( caseaction,"new_testmodule_casehistory", function (caseaction) { //alert("OK"); if (ConfirmMessage != "") { Notify(ConfirmMessage, true); }
Notify(JSON.stringify(caseaction, null, 4)); // debug object}, errorHandler ); $('#new_updatecase').toggle(false); }
Now this works except that the lookup in my custom entity which should point back to the original case is blank. The lookup is there and works, I can click on the blank link to the case and get back to the case. How do I set the display name. Everything I've googled for seems to indicate I just need to set a "Name" property in the REST call but it clearly doesn't work. So what am I doing wrong?
I've just tried adding an extra debug in there and it seems that the Name property is not set. Although the Id for the lookup is set correctly and Name exists as a property, it comes back as null!