Best answer

Resource not passing down outputFields

  • 5 August 2021
  • 2 replies
  • 57 views

Userlevel 1

Hello! I’m currently building a Zapier integration. I have a resource - let’s call it “pet”. “pet” has list, search, and create actions defined. Now, since all of these have the same output format, I’d like to define `outputFields` and `sample` once in the main resource object and be done with it. The docs suggest that this is possible, and that my actions should automatically inherit `outputFields` and `sample` from the parent resource. However, when I try to test these functions with a Zap I created, the `label` for each of the output fields do not appear:

This is supposed to say “Pet ID”, for example; the field is defined in the resource as follows:

export const pet = {
...,
list: ...,
create: ...,
search: ...,


outputFields: [
{
key: 'id',
label: 'Pet ID',
type: 'string',
},
],
}

How can I get my resource to automatically pass down its outputFields/sample to its actions (list, create, search in this case)?

I found that if I manually go into each of the actions and specify something like `outputFields: pet.outputFields` then it will work. However, I’m wondering if this is truly necessary, since it seems reasonable to be able to define it once in the resource and have it carry over.

icon

Best answer by tabitabibito 6 August 2021, 15:54

View original

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

2 replies

Userlevel 1

Solved it; had to manually specify the `resouce` field for each of the actions. I had assumed it was automatically set when it was included in the resource.

Userlevel 7
Badge +11

That’s fantastic! Thanks so much for sharing your solution here, @tabitabibito! :)