function SetTitle(executionContext) { var formContext = executionContext.getFormContext(); var ticketnumber = formContext.getAttribute("ticketnumber") var contact = formContext.getAttribute("customerid"); //var regardingObjectDetails = formContext.getAttribute("regardingobjectid").getValue(); var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() "/api/data/v9.1/contacts(ContactId)?$select=funds_personid", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { if(ticketnumber != null && contact != null){ var result = JSON.parse(this.response); var funds_personid = result["funds_personid"]; var Ticket = ticketnumber.getValue(); var con = contact.getValue()[0].name; var title = formContext.getAttribute("title").setValue(Ticket " " con " " funds_personid) } } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(); }
Hey guys I am trying to get this Id field from contact entity and set case title to few values
but Dynamics gives me error ContactID is not defined. could you guys tell what the issue is
Person ID is text field