Created
April 22, 2020 20:06
-
-
Save PiotrKrzyzek/7888c929e8fae1cc602c4ead4d713559 to your computer and use it in GitHub Desktop.
Zapier Array Split
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for inputData set: | |
// keys = the array's list of key values (Such as when WooCommerce sends of two arrays for one array of data. Such as "metakeys" | |
// values = is the array's value list | |
// of course, you can modify this easy to simply accept one array ... or as many as you'd like. | |
// Currently, this code does NOT do any error checking (other than exists()) nor sanitization | |
output = { | |
'the_output_field_label_here': '', | |
} | |
if( inputData.keys ){ | |
var keys = inputData.keys.split(','); | |
var values = inputData.values.split(','); | |
if( keys.indexOf('additional_field_107') > 0 ) { | |
output['the_output_field_label_here'] = values[keys.indexOf('additional_field_107')]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment