I have a trigger, which returning ar array of custom fields. each element of the array have a two keys FIELD_VALUE and FIELD_NAME.
When I am mapping these fields in an action there are only two field available :
- FIELD VALUES ==> comma(,) separated values of all custom fields key FIELD_VALUE, similarly
- FIELD NAMES ==> comma(,) separated values of all custom fields key FIELD_NAMES
I want to convert all of the fields in a key:value pair. So the value of FIELD_NAME will be a key and value of FIELD_VALUE will be a value.
I have tried to use code by zapier but it is not working as expected:
Here is my JS code:
var names = (inputData.names).split(',');
var values = ((inputData.values).toString()).split(',');
var obj = names.reduce((obj, key, index) => ({ ...obj, =key]: valuesbindex] }), {});
The problem is null values, Zapier removing null values from comma (,) separated string.