Remove Blank/Empty/Null Values from Array of Line Items Using Code

  • 19 January 2022
  • 0 replies
  • 599 views
Remove Blank/Empty/Null Values from Array of Line Items Using Code
Userlevel 7
Badge +14

📌  We do our best to ensure that the code in these articles works as advertised, but please be aware that Zapier Support does not officially help with code steps due to their advanced nature. Feel free to comment on the article or ask in the Zapier Community, where we have code-savvy folks (including the author of this post).

QEver wanted to remove blank/empty/null values from an array of line items?
A: Use a Code app as a Zap step: https://zapier.com/apps/code/help

 

Code step configuration using JavaScript

NOTE: Map your line items array to the right side value for the “Set” Input Data variable in place of “A,,B,,C”.

 

 

Copy the Code

let Set = inputData.Set.split(","); // creates array by splitting Input Data variable at commas

Set = Set.filter(i => i); // filter out blank/empty/null values

output = [{Set}];

 

Results

Code step results WITHOUT filtering blank/empty/null values from an array of line items:

 

Code step results WITH filtering blank/empty/null values from an array of line items:

 

 

Contribution by Troy Tessalone

Troy is a Certified Zapier Expert who automates workflows with no-code and low-code apps to help clients save time and make money.


0 replies

Be the first to reply!

Reply