Skip to main content

I am creating a Zap that looks at campaign records related to a contact that is related to an opportunity record in Sugar CRM, then determines which campaign record has an activity date closest to the opportunity create date. 

 

To determine the closest date, I have set up a run python action for the simple calculation, however the number of related campaigns may be different every time, depending on the specific contact. Each campaign name and activity date comes out as a separate line item for use in future steps.

 

An issue arises when setting up the inputs for the Run python action as it asks for an explicit number of inputs, but that number will not always be the same. How can I format or modify the output from my ‘Find Campaigns’ action so that ALL results are utilized as a single input for my run python action?

 

 

Hi ​@David_R 

Try using this Zap action: Formatter > Utilities > Line Items to Text

This allows you to convert array items to a text string.

Make sure to use delimiters to help separate the data points in a line item (e.g. ||) and across line items (e.g. ^^), that way the Code can parse the text string.

 

TIP: Share example output from the Formatter step and the current code with ChatGPT and ask it to update the Code for you to use in the Zap Code step.

 

Here’s a related guide that covers the concept:
 

 


Troy, I appreciate your response and tip on formatter. However, my problem still exists with the Formatter Step - the number of line items is unknown depending on output from the previous step. 

 

Here is an example output from my previous step:

 

For this specific example, there are 2 record results with numerous line items for each record. I can utilize Formatter to handle this specific case with only 2 record results, but the UI will not allow me to select ‘result’ or ‘records’ as a line item. Is there a way to make the Formatter code more robust so that it inputs X number of record results? 


Hey ​@David_R 👋

Were you able to make any progress on this? Would love to hear what the solution was if you’ve solved it! 🙏

If not, can you share a screenshot showing where it’s only allowing you to select ‘result’ or ‘records’ and not the individual line item fields? Just be sure to use a tool like Zappy to remove any sensitive info like names, emails etc. before sharing as this is a public space.

Also, are you using SugarCRM’s Find Record, Custom Action or a Webhooks action to find the campaigns? Asking as I can’t see any action called “Find Campaigns” listed for SugarCRM. It could be that the setup on that action needs adjusting to get the line items fields to be output correctly. 🤔 

Looking forward to hearing from you!