I have a scenario using the Monday.com module “Create a Subitem” that creates a new subitem on Board B when a selection is made in a Connect Boards column on Board A, using the selection as the parent item for the subitem.
This works fine for the first selection, but on subsequent selections, the Item ID of the first selection is always used, not the most recent selection.
In the attached image the Item ID (where the subitem should be placed under) is defined using {{1.value.linkedPulseIds[5].linkedPulseId}}. In this definition, the 5 causes the fifth selection to be used.
Is there a scripting option here that I could use to cause it to select the last (latest) selection? Something like {{1.value.linkedPulseIds[LAST].linkedPulseId}} (which is not a real thing).
It may be that my circumstance is a little different than yours was, as I have just the one bundle, which has multiple value:linkedPulseIds within it. As a result, when I use IMTAGGLENGTH, I always get “1” which always results in the first of the linkedPulseIds.
Is there a way to configure the Iterator or Array aggregator to count the linkedPulseIds?
I was able to use the reverse() function by itself as shown below and the scenario runs fine, providing the last selected linkedPulseId instead of the first. Is this going to be a problem?
No, that will not be a problem. I generally prefer being explicit with arrays. Also, in this situation, you don’t need the Set variable module.
The way I would do it would be to use this expression in the Item ID of the monday module: {{get(map(reverse(1.value.linkedPulseIds); "linkedPulseId"); 1)}}