I have the output of a SalesForce SOQL snap that is a JSON in this format.
[
{
"QualifiedApiName": "Accelerator_Pack__c"
},
{
"QualifiedApiName": "Access_Certifications__c"
},
{
"QualifiedApiName": "Access_Requests__c"
},
{
"QualifiedApiName": "Account_Cleansed__c"
},
{
"QualifiedApiName": "Account_Contract_Status__c"
}
]
I am attempting to take those values and turn them into a string with the values separated by commas, like this, so that I can use that in the SELECT clause of another query.
Accelerator_Pack__c, Access_Certifications__c, Access_Requests__c, Account_Cleansed__c, Account_Contract_Status__c
From the documentation, my understanding was that .toString() would convert the array into a comma-separated string, but as shown in the attached image, it isn't doing anything. Does anyone have experience with this?
You need to aggregate the incoming documents.
Use the Aggregate
snap with the function CONCAT
. This will give you a |
delimited concatenated string as the output like as follows.
Accelerator_Pack__c|Access_Certifications__c|Access_Requests__c|Account_Cleansed__c|Account_Contract_Status__c
You can then replace the |
with ,
like $concatenated_fields.split('|').join(',')
or $concatenated_fields.replace(/\|/g, ',')
.
Following is a detailed explanation of the configuration.
Sample Pipeline:
Sample Input:
I set the sample JSON you provided in a JSON Generator
for testing.
Aggregation:
Result of Aggregation:
You get a |
delimited concatenated string.
Mapper Expression:
Output:
Both expressions give the same result.