Hi,
I want to populate a field which is on contact email field on another entity pde .
pde is related to case and there is no relation from pde to contact.
Thanks
Hi,
I want to populate a field which is on contact email field on another entity pde .
pde is related to case and there is no relation from pde to contact.
Thanks
Hi Partner,
What is the relationship between these three entities?
I know that case and pde are 1:N relationship, what about case and contact?
1:N or N:1?
Based on your code, case and contact are 1:N, so one pde has one case, but one case related to multiple contacts, which contact's email do you need?
The 1:N relationship you used is custom?
There are OOB N:1 relationships between case and contact, why not use it?
Hello Guido,
With javascript, I got the following code and the field to populate is written in a loop in One To Many Relationships, how to populate field and which line I need to assign.
Is it after the for loop.
function populateCaseFieldsOnPDE(executionContext)
{
debugger;
var formContext = executionContext.getFormContext();
var associatedCase = formContext.getAttribute("har_associatedcase").getValue();
if(associatedCase != null)
{
var caseId = formContext.getAttribute("har_associatedcase").getValue()[0].id.slice(1, -1);
var req = new XMLHttpRequest();
req.open("GET", Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.2/incidents(" + caseId + ")?$select=har_klscodepostcode,har_siteaddress,har_customercontactname,har_sitecontactname&$expand=har_incident_contact_Case($select=emailaddress1)", false);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Prefer", "odata.include-annotations=*");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var result = JSON.parse(this.response);
console.log(result);
// Columns
var incidentid = result["incidentid"]; // Guid
var har_klscodepostcode = result["har_klspostcode"]; // Text
var har_siteaddress = result["har_siteaddress"]; // Multiline Text
var har_customercontactname = result["har_customercontactname"]; // Text
var har_sitecontactname = result["har_sitecontactname"]; // Text
// One To Many Relationships
for (var j = 0; j < result.har_incident_contact_Case.length; j++) {
var har_incident_contact_Case_emailaddress1 = result.har_incident_contact_Case[j]["emailaddress1"]; // Text
}
} else {
console.log(this.responseText);
}
}
};
req.send();
}
}
Thanks
if there is a relation between case or contact (or one between case, another entity and after contact) it is possible with some javascript (Xrm.WebApi or similar)
hope it helps
Daivat Vartak (v-9d...
181
Super User 2025 Season 1
Siv Sagar
149
Super User 2025 Season 1
Vahid Ghafarpour
124
Super User 2025 Season 1