constdata=JSON.parse(inputData.data);constfields=data.fields;constfieldMap={/// change the numbers to the field idtextField1:'0',textField2:'1',textField3:'2',numField1:'3',numField2:'4',numField3:'5'}functionactivityValues(fieldMap,fields){Object.keys(fieldMap).forEach(key=>{letfound=false;Object.values(fields).forEach(field=>{if(field.id===fieldMap[key]){fieldMap[key]=field.value;found=true;}elseif(field.id===fieldMap[key].id){fieldMap[key]=field.value[fieldMap[key].target];found=true;}});if(!found){fieldMap[key]=null;}});returnfieldMap;}output=activityValues(fieldMap,fields);returnoutput;
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.