Skip to main content

Hi, for a project that i'm working on i need to have the names of the vars for my custom code with code by zapier

What i want to have is besides the values 322,133,call,bellen I also want ID,STATUS, last activity type,last activity subject as vars in my js?

 

is there anyway how I can get that data?

Assuming that somewhere in your workflow the Data is parsed into an Object, then Object.keys() should work: 
 

const data = {
ID: 322,
Status: 133,
Last Activity Type: 'call',
Last Activity Subject: 'Bellen'
};

console.log(Object.keys(data));
// expected output: Array a"ID", "Status", "Last Activity Type", "Last Activity Subject"]

output = {vars: Object.keys(data)}]


reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys


Hi @Jeff Thorns - Instead of passing all the values in the same field called data, try creating a separate field for each variable. This way, you’ll have access to each variable by its name via the inputData object. for example, if you add a new field called ID, you will be able to access it using inputData.ID.

 


Hi @Jeff Thorns!

I wanted to check in with you on this one, since we didn't hear back after our last message. Did you still need help here or were you able to resolve things? Please let us know :)