Skip to main content

i have successfully ran a report (salesforce) and then used formatter text to line-item to create format and i now have Output 1 with 10 fields underneath it, Output 2 with 10 fields underneath it, etc..…i need to create an array of the 10 fields, so i can loop through it.

also tried formatter line-item to text to create format and i now have Output Item 1 with all the fields in a single line (comma delimited), Output Item 2 with all the fields in a single line (comma delimited), etc… 

The data is there and parsed correctly just can figure out how to loop it (create an array)

Thanks

Hi ​@Jazzy3 

Try using this Zap action: Looping - Create Loop from Line Items

Help: https://zapier.com/apps/looping/integrations#help

 

If you need more help, post screenshots showing how your Zap steps are outlined and configured in EDIT mode with the field mappings visible in the CONFIGURE tab along with the DATA IN/OUT for steps.


thanks for reply, i cannot get the outputs to be seen by the loop. the Outputs have all the data i need and they are comma delimited.

This is Line-Item to Text

 


@Jazzy3 

We would need to see more screenshots to have more context about your Zap steps order, how the Zap steps are configured, and the DATA IN/OUT being used to test.

If you need more help, post screenshots showing how your Zap steps are outlined and configured in EDIT mode with the field mappings visible in the CONFIGURE tab along with the DATA IN/OUT for steps.


 

also tried Text to Line-Item and got this

 


@Jazzy3 

Help us have true context by posting these screenshots:

  • how your Zap steps are outlined
  • the DATA OUT from the Salesforce step including the data points that you are trying to use

Hey ​@Jazzy3,

You may want to look into Formatter→ Text → Split Text action in Zapier  to split the text with delimiter as comma. You can do this after the looping step. It will solve your problem of data is there but with commas. Here are some helpful article about Formatter and Looping in Zapier-
https://zapier.com/blog/zapier-formatter-guide/

https://zapier.com/blog/looping-by-zapier-guide/

So your workflow will look something like this-

  • Previous actions/ trigger to get the line items
  • Create loop from line items
  • Formatter→ Text → Split Text action
  • Dynamically map the data to your desired action 

Hope it helps!


my problem was resolved with code. the issue was “it seems the data is passed in this format by default. While Formatters can combine values that are already grouped together, in your case the requirement is to separate each field from every individual record across all ~200 records and then recombine them. Unfortunately, Formatter alone wouldn’t be the right tool to achieve this.” the Text to Line-Item gave what appears to the same exact output as the code below, but for some reason the Looping step wouldn't receive it. i used AI to create code. the end result of this was i am able to export data from Salesforce using a Run Report Action Event and then use the data. the reason for doing this is that interfaces cannot pull dynamically from Salesforce so i had to create a ZAP to delete all the records and then run the report and add all the records. this was done in case we get new Accounts in our salesforce. 

 

const step3Output = inputData.step3_output || '';

 

// Split the output string by commas and trim whitespace

const items = step3Output.split(',').map(item => item.trim());

 

// Prepare an array to hold the combined fields

const combinedFields = [];

 

// Assuming each output item contains exactly 11 fields, we will process them in chunks of 11

for (let i = 0; i < items.length; i += 11) {

  const fields = items.slice(i, i + 11);

 

  // Ensure we have exactly 11 fields before pushing to the combinedFields array

  if (fields.length === 11) {

    combinedFields.push({

      HouseholdName: fields[0],

      Person18Character: fields[1],

      HouseholdID: fields[2],

      Household18ID: fields[3],

      Email: fields[4],

      FirstName: fields[5],

      LastName: fields[6],

      Rating: fields[7],

      RelManager: fields[8],

      ClientRevFreq: fields[9],

      ClientConFreq: fields[10],

    });

  }

}

 

// Prepare the output as a flat object

output = { combinedFields };

 


Thanks so much for taking the time to share the solution and code here ​@Jazzy3 🙌 This is super helpful for others who might run into something similar. I’m so glad you got everything working and hope you have a great rest of the week! 🚀