01-19-2024 12:37 AM
My Input looks like this.
{
"totalCount": 4,
"dataList": [
{
"IfaNumber": "1",
"alink": "",
"agroupId": ""
},
{
"IfaNumber": "2",
"alink": "",
"agroupId": ""
},
{
"IfaNumber": "3",
"alink": "",
"agroupId": ""
},
{
"IfaNumber": "1",
"alink": "",
"agroupId": ""
}
]
}
Can anyone help me to get all the unique IfaNumber from the json list in mapper and form the output in form of ["1","2",3"]
So that I can pass it in Salesforce Lookup snap to get all the account Id for respective IfaNumber.
Solved! Go to Solution.
01-19-2024 12:48 AM
Hello @akarsh,
You can try with the following expression in a Mapper Snap:
$dataList.map(x => x.IfaNumber).filter((x,ind,arr) => arr.indexOf(x) == ind)
This expression, first maps only the IfaNumber values from the dataList array, then filters out the duplicates.
Attaching the sample pipeline below.
Let me know if this helps you!
Regards,
Aleksandar.
01-19-2024 12:48 AM
Hello @akarsh,
You can try with the following expression in a Mapper Snap:
$dataList.map(x => x.IfaNumber).filter((x,ind,arr) => arr.indexOf(x) == ind)
This expression, first maps only the IfaNumber values from the dataList array, then filters out the duplicates.
Attaching the sample pipeline below.
Let me know if this helps you!
Regards,
Aleksandar.
01-21-2024 07:16 PM - edited 01-21-2024 08:23 PM
One more question on this, I want to send this data to a lookup snap , is it possible to send the data with () brackets instead of []?
You can see here that , its a IN query it's syntax should be like IN ('1','2','3') but if I pass the mapper data directly it goes as ([1,2,3])
01-22-2024 03:35 AM
Thanks, SOQL snap helped here there is a option to not add escape char there.
01-19-2024 02:48 AM
Thanks a lot. I will try it out.