Hi all,
unfortunately I am stuck with this code here.
From a Project I create a Case via a custom button (+ New Ticket - IT), it works fine.
I now need to add in my following Javascript, to lookup the account in this project and pass it to the case form
field "customerid", when Form is opening.
This goes beyond my knowledge of javascript at the moment, I am still learning.
function openItTicketForm (primaryControl) {
var formContext = primaryControl;
var recordGuid = formContext.data.entity.getId().replace("{", "").replace("}", "");
var recordName = formContext.getAttribute("pde_name").getValue();
var recordType = "pde_project";
var entityFormOptions = {};
entityFormOptions["entityName"] = "incident";
entityFormOptions["openInNewWindow"] = true;
entityFormOptions["formId"] = "3962b5bd-1ad2-ed11-a7c7-000d3adf75ee";
// Set lookup column
var formParameters = {};
formParameters["skt_pde_project"] = [{ id: recordGuid, name: recordName, entityType: recordType }];
formParameters["skt_requestto"] = 921720001;
// Open the form.
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});
}