The Wiki gives examples for filtering directly on a ressource, but i was unable to adapt these examples to filter on nested objects also.
Or is there a better way to solve this request with coding inside ETM?
A helpful hint would be appreciated :-)
Kind Regards
Christian
Page 1 / 1
‘Filtering’ refers to the the fields that are returned, not to the values within those fields. You are alrteady using filtering in your Parent_Event ‘Fields’ definition where you are indicating that you only want the linked event data returned, and not all of the other fields for the event.
To find the specific bit of data (in a one:,many relationship) that yiu are interested in you’ll need to search through the results with JavaScript:
thanks for the Javascript-Code. I adapted your solution for the Id instead of remarks. Therefore it can be used in a variable for the Record for Update. I also enclose it into “try-catch” to avoid undefined errors.
try { variables.Parent_Eventv0].linkedEventGroups.filter(function(group){return group.linkReasonId==39}).map(function(group){return group.id})i0]; } catch (ECMAException){ // Abfangen wenn noch keine Eventgruppe existiert
}
i also have a separate variable for the following 2 Mappers for the Linking for usage in “No value When...”
try { if (typeof variables.LinkedEventGroupID !== 'undefined' && variables.LinkedEventGroupID.length > 0) { // the array is defined and has at least one element true; } else true; } catch (ECMAException){ // Abfangen wenn noch keine Eventgruppe existiert false; }
As it is obvious i am no Java Professional. I believe there is definitely a smarter solution - but this one works for me at the moment.
Kind Regards
Christian
Postscript:
the way above had the issue, that only the first set of Events would be linked, even when there are multiple Events.
Therefore i check for both EventMappers if the Event is included in the linkedEventGroup
var result = null; if (variables.Parent_Eventt0].linkedEventGroups.filter(function(group){return group.linkReasonId==39}).map(function(group){return group.id}))0]) { result = true; } result;