Question

Pick off a child key - just one value

  • 20 April 2023
  • 5 replies
  • 264 views

Userlevel 1

I am trying to grab just one value from this object but cannot seem to get zapier to grab it.  Can someone help with the proper syntax.  

I’ve attached a partial screenshot as the object is long, but I need the value from the 18th entry.

I’ve used the following in the “pick off a child key” field - entity.custom_fields.18.value

It’s not giving me just that value in the next step.  Instead I get the whole payload and there is a “value” entry that contains all the values separated by commas.  All I need is the one value.

 

Thanks for your help

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 6
Badge +8

I’d just a Code by Zapier step and use the following JavaScript (with the comma separated list of values as the inputData for the code step):

let values = inputData.values.split(",");
let value18 = values[17];

output = [{value18}];

 

Userlevel 6
Badge +8

Hi @JacobRob!

Just checking back in to see if you were able to try out this solution / whether it worked for you?

Userlevel 1

Hey Todd,

 

Thanks for your help.  I ended up grabbing the webhook as raw instead, parsing it to a json object, and grabbing the value i needed that way before seeing your reply.  Thanks again. 

Userlevel 6
Badge +8

@JacobRob Glad your got it working! Starting with raw data is almost always the ideal situation, in my opinion :)

I am trying to grab just one value from this object but cannot seem to get zapier to grab it.  Can someone help with the proper syntax.  

I’ve attached a partial screenshot as the object is long, but I need the value from the 18th entry.

I’ve used the following in the “pick off a child key” field - entity.custom_fields.18.value

It’s not giving me just that value in the next step.  Instead I get the whole payload and there is a “value” entry that contains all the values separated by commas.  All I need is the one value.

 

Thanks for your help

 

To grab a specific value from an object in Zapier, you can use the dot notation to access nested keys. Based on the information provided, it seems like you want to retrieve the value from the 18th entry of the entity.custom_fields object.

Instead of using the syntax entity.custom_fields.18.value, which may not work as expected, you can try using array indexing to access the specific entry. Here's an example of the modified syntax:

entity.custom_fields[17].value

In most programming languages, array indexing starts from 0, so the 18th entry would be accessed using the index 17. By using square brackets [ ] instead of a dot, you can directly access the specific entry within the array. Make sure to adjust the index based on the zero-based indexing system used in your programming environment.