Best answer

Defining Dynamic Output Fields

  • 30 January 2024
  • 2 replies
  • 80 views

I have been trying to find a way to define dynamic output fields for a hook trigger so that they would be available in the later steps but been having no luck. I saw this post which would be similar to my case, but no input values will be taken from the user.

 

This is the a sample payload for the performList:

{
"id": "123456",
"customFields": {
"fieldName1": "fieldValue1",
"fieldName2": "fieldValue2",
"fieldName3": "fieldValue3",
}
}

 

The field names would vary depending on the account subscribed to the hook, and when there are changes made to the field values, the payload will then include a to and from fields for the field that changed, i.e.:

{
"id": "123456",
"customFields": {
"fieldName1": "fieldValue1",
"fieldName1To": "fieldValue1To",
"fieldName1From": "fieldValue1From",
"fieldName2": "fieldValue2",
"fieldName3": "fieldValue3",
}
}

 

How can I define the output fields for the To/From fields so that these would be available in the action step? Any and all help would be greatly appreciated. Thank you!

 

P.S. I’m using the CLI for the integration.

icon

Best answer by temr 30 January 2024, 14:53

View original

2 replies

Userlevel 2
Badge +2

Hi @temr,

Seeing that you are already using the CLI platform, in the trigger’s code, add a function that would fetch the account-specific extra fields. These fields should be returned in the same format (schema as an input field).

Then in the output field definition, call this function. This would render the dynamic output fields along with the statically defined output fields.

The following articles should also help:

 

All the best,

Hi @Osas ,

 

Thanks for responding. Though that was my roadblock earlier, currently we don’t have a way to fetch the ‘To’/’From’ fields since this isn’t being stored, rather it’s sent dynamically. But I was able to figure it out. I manipulated the response being sent in the performLoad to add the necessary key-value pairs.

 

Looks like that worked for both the Zap setup and the Live Zap.

 

Thanks again. :)

Reply