Skip to main content
Question

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


jacob_nolley
Forum|alt.badge.img

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
      }
}

 

Did this topic help you find an answer to your question?
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

Forum|alt.badge.img+9
  • Zapier Staff
  • 331 replies
  • October 8, 2020

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;

 

 


jacob_nolley
Forum|alt.badge.img
  • Author
  • Tinkerer
  • 12 replies
  • October 8, 2020

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?


Forum|alt.badge.img+9
  • Zapier Staff
  • 331 replies
  • October 8, 2020

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.