Skip to main content
Nintex Community Menu Bar
Solved

Javascript: Iterate child relationship items?

  • July 12, 2024
  • 2 replies
  • 39 views

Forum|alt.badge.img+10

Is it possible to iterate child relationship items using javascript for a row in a model that has child relationships?

Looking in skuid.$M(‘ModelName’).data[rowNum] it doesn’t appear that there’s any reference there to an array of child relationship objects, and I’m not finding anything in the SKUID documentation about this as well. I’d imagine that being able to access the array of child relationship items in javascript is a beneficial ability and should exist in some form.

Any assistance is appreicated. Thanks!

Best answer by Mark L

Ah I see it now. It looks like the fields only appear if there actually are child relationship records in them.

To access you would use for example:

//This is an array
let childRelationshipItemsArray = skuid.$M(‘ModelName’).data[rowNum].TheChildRelationshipNameDisplayedOnTheModelFields.records

2 replies

Forum|alt.badge.img+10
  • Author
  • Scholar
  • Answer
  • July 12, 2024

Ah I see it now. It looks like the fields only appear if there actually are child relationship records in them.

To access you would use for example:

//This is an array
let childRelationshipItemsArray = skuid.$M(‘ModelName’).data[rowNum].TheChildRelationshipNameDisplayedOnTheModelFields.records

Forum|alt.badge.img+17

You beat me to it but I was about to past this. It is how you can reference the child records in UI only formula fields, or text and image components. ContentDocumentLinks in this case is the child relationship field on the model

{{{ContentDocumentLinks.records.0.ContentDocument.LatestPublishedVersion.Id}}}