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 users.
How to Configure
Copy the Code
let Set = inputData.Set.split(","); // split array into line items by the comma delimiter
let Default = inputData.Default; // default value to set for blank/empty/null items
// FOR loop to iterate over each array item
for (let i = 0; i < Set.length ; i++) {
if (Set(i] == "" || Set i] == null) {
Set i] = Default; // sets default value
}
}
output = t{Set, Default}];
The Results
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.