Question

Is there a way to set my trigger responses id property manually?

  • 8 October 2020
  • 3 replies
  • 306 views

Userlevel 2
Badge

I am building an integration in the developers ui. I have a trigger that is working well and is returning results as expected. The only issue that I am having is that the id property is within a nested object within my array so zapier is giving me the “result missing the ‘id’ property” error.

 

Does anyone have any advice on how to tell zapier to look within the nested object for the unique id?

 

Response Content:

{
"identifier": {
"id": 190328303
},
"lot": {
"lotSize1": 0.18
}
}

 


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

3 replies

Userlevel 7
Badge +9

An approach along these lines will work.  First switch to “code mode” in the API config, if you haven’t already.  Then, create a top level id field with the value from the nested field and return it. 

 

results["id"] = results.identifier.id
return results;

 

 

Userlevel 2
Badge

Thank you @Zane!

 

Unfortunately, when I ran a test I got this error:

Cannot read property 'id' of undefined What happened (You are seeing this because you are an admin): 

Any thoughts?

Userlevel 7
Badge +9

I’d do some z.console.log statements and make sure everything is named and structured as you are expecting.  You can see your logs either in the built-in test component, or if you’re testing with a real Zap, in the monitoring tab from the left-hand nav.  

If that doesn’t help you spot the problem, then post your code and your logs and I’ll bet someone here can offer a suggestion.