Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Pulling Multiple IDs From A Bundle, Into An Array

Avatar

Level 5

Hello

I need to pull two different types of IDs from the data below

I need the user.id from each NTAG as well as each team.id from each NTAG.

The goal is to have an array of IDs to include in a Update reply.

 

[
    {
        "body": {
            "data": [
                {
                    "ID": "68c0562903223440aff85176b936c54d",
                    "objCode": "NOTE",
                    "owner": {
                        "ID": "62a0af46002ec17cbee98efaa8105fda",
                        "name": "Fusion Integration",
                        "objCode": "USER"
                    },
                    "entryDate": "2025-09-09T16:30:33.128Z",
                    "isReply": false,
                    "tags": [
                        {
                            "ID": "68c056290322345e296bfb31382c3c1d",
                            "objCode": "NTAG",
                            "team": null,
                            "user": {
                                "ID": "redacted",
                                "name": "redacted",
                                "objCode": "USER"
                            }
                        },
                        {
                            "ID": "68c056290322345d95d488354dbf6c59",
                            "objCode": "NTAG",
                            "team": null,
                            "user": {
                                "ID": "redacted",
                                "name": "redacted",
                                "objCode": "USER"
                            }
                        },
                        {
                            "ID": "68c056290322345cc66e8cbbac7af1d1",
                            "objCode": "NTAG",
                            "team": null,
                            "user": {
                                "ID": "63c1a27e00279b070b1f1bea390bb479",
                                "name": "Test Worker",
                                "objCode": "USER"
                            }
                        },
                        {
                            "ID": "68c0562903223460b62c7882ad2c71ec",
                            "objCode": "NTAG",
                            "team": {
                                "ID": "6823962200097e8787dfcd4e08e2b0bc",
                                "name": "Test Team",
                                "objCode": "TEAMOB"
                            },
                            "user": null
                        },

 

Eric_D_Miller_0-1757612311885.png

 

 

 

Any assistance would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 2

@Eric_D_Miller If you want every ID from every object in the array within "body.data[]", you can use the iterator module as @ChrisStephens mentioned. You can also use this:

{{deduplicate(remove(merge(map(flatten(map(2.body.data; "tags")); "user.ID"); map(flatten(map(2.body.data; "tags")); "team.ID")); null))}}

This will pull all user.ID values and all team.ID values within the payload. Then since you are using deduplicate, I added that in as well. 

View solution in original post

6 Replies

Avatar

Level 2

I would use map() and merge() and remove().

First I will use map() to build 2 sets of arrays for each object type: users, and teams

Then use merge() to combine the two arrays.

Finally use remove() to get rid of any empty (null) values.

{{remove(merge(map(2.body.data; "user.ID"); map(2.body.data; "team.ID")); null)}}

This should give you an array of only the IDs of the individual object records. (The "2" is the module number. Replace it with the module you are referencing).

 

 

Avatar

Level 5

Hi Dan,

 

Thank you for the reply, unfortunately I am not getting any values from that.

Eric_D_Miller_0-1757940729942.png

Eric_D_Miller_1-1757940867427.png

 

 

Here is the input bundle if that helps:

[
    {
        "name": "Tags",
        "scope": "roundtrip",
        "value": []
    }
]

 

Avatar

Level 5

Pointing the '2.body.data' variable to '2.body.data[].tags' instead gives me values, but only from the first data array.

 

Eric_D_Miller_1-1757943928714.png

 

 

Highlighted yellow are the tags I am getting
and green is what tags I also need included

Eric_D_Miller_0-1757943813233.png

 

Any ideas?

 

Avatar

Community Advisor

If you map your notes array into an iterator, then you can pull your tags for each comment by referring your map command to the output of your iterator. If you want to pull them back into a single array, then put an aggregator in place.

Avatar

Level 5

Chris,

 

My expression above was indeed put into an iterator, yet I only got the user ID tags highlighted in yellow. I need also the IDs above highlighted in green.

 

Is my expression incorrect?

 

Eric_D_Miller_0-1758018085751.png

I essentially have one array that contains several arrays, each containing a user.ID or a team.ID that will ultimately be put into an array formatted to enter into a notify module. I have most of this figured out, I just can't seem to get each unique user and team ID in the entire topmost array, and only get the data from the first tags[1] array.

 

Eric_D_Miller_0-1758035516863.png

How do I make the body:data point to all data sets instead of just [1]?

 

Avatar

Correct answer by
Level 2

@Eric_D_Miller If you want every ID from every object in the array within "body.data[]", you can use the iterator module as @ChrisStephens mentioned. You can also use this:

{{deduplicate(remove(merge(map(flatten(map(2.body.data; "tags")); "user.ID"); map(flatten(map(2.body.data; "tags")); "team.ID")); null))}}

This will pull all user.ID values and all team.ID values within the payload. Then since you are using deduplicate, I added that in as well.