Retrieving nested variables in an array

I have read several other community posts on this topic, but still can’t quite figure out how to get to some of the nested data in my array. I have an array aggregator that is pulling in the results of a Salesforce SOQL query. The output is as follows:
image

I am having trouble getting to the Email and Name fields under the CONTACT objecdt, and the Borrower Name and Amount Requested fields under the APPLICATION object.

I thought using a map() function would work, but I’m not getting anything when using this formula in my email module:

image

I’m guessing/hoping that I’m just missing some syntax, or need to embed another function to get to that data, but hoping someone has some perspective on this!

Thank you!

Hey Brian, you’re on the right track.

You are using the correct notation, where you access the field in the collection with the dot notation.

In your screenshot for getting the application name, the issue is you are using .name, and it looks like your field isn’t “name” it is called IvytekTestPkg__BorrowerName__c, you need to adjust your IML so that you copy the exact “raw” field name from the output (also make sure you copy the correct collection “raw value”

So steps:
click the output → download output → copy the collection and the field you need (to make sure you have the correct values in your mapping) → replace your value this collection.field → outside of your map function, add a get(map…);1), so that you don’t return an array.

2 Likes

Thank you for the response - this is huge help! So now, its working for a single record in the array, but I need to generate 3 emails (one for each). I added an Iterator module, but can’t seem to be able to use the same map() function for the iterator.
image
I tried to use the bundle index as part of the get() function, but probably doing something wrong here:
image

Output from my last test:
image

Now that you are in the iterator, you don’t need to use the map function, you can directly access each field as you need it.

Here is what I would do:

Run the data into your iterator to populate the output, now instead of how in your screenshot you see the …__Contact__r, you should now also see the actual fields in the collection, which should look something like this:
image

From here you should be able to just select the contact’s name and email, and the application’s borrower name and amount requested.

2 Likes

Thanks for the reply. Unfortunately, I don’t see the collapsible section in my iterator:
image

Seems the data structure from my Salesforce query (which then passes into an Array Aggregator) isn’t as simple.

thoughts?

Could you download the output from the array aggregator and provide me with it?

output.json (3.1 KB)

It seems to populate for me:
image

If it still doesn’t give you the option to select the fields you need, try this:

Copy the collection output from the iterator in my example: {{5.IvytekTestPkg__Contact__r}}
image
Paste it outside of Make, and now add the dot notation manually.
image

Here your iterator is module 45. so it would likely be {{45.IvytekTestPkg__Contact__r}}, and manually add the dot notation for name: {{45.IvytekTestPkg__Contact__r.Name}}, and paste this into your scenario and see if it populates.

image

1 Like

Manually populating the .dot notation in the bluepint json worked! Thank you for the suggestion. I’m going to open a ticket with support to see why the UI is not showing the same thing. Really appreciate your help here!!

2 Likes

No problem, one reason that the UI may not show the correct output for the iterator can be when you define an IML inside the iterator, so something like this:
image

But I don’t know all the possible causes.

2 Likes

OK - hopefully support will have some ideas. (:smile:

2 Likes