How can the custom field be used as a view column in the requirements.json file?
Hello everyone!
I'm trying to add two custom fields defined in the requirements.json file to a custom view that is set in the same file by passing the ticket field property key. For instance:
{
"ticket_fields": {
"support_description": {
"type": "text",
"title": "Support description"
},
"number_of_issues": {
"type": "integer",
"title": "Number of issues"
}
},
"views": {
"view_tickets_updated": {
"active": true,
"conditions": {
"all": [
{
"field": "status",
"operator": "less_than",
"value": "solved"
},
{
"field": "assignee_id",
"operator": "is",
"value": "current_user"
}
],
"any": []
},
"default": false,
"description": "Tickets updated",
"output": {
"columns": ["status", "requester", "number_of_issues", "support_description", "assignee"],
"group_by": "assignee",
"group_order": "desc",
"sort_by": "status",
"sort_order": "desc"
},
"title": "Tickets updated <12 Hours"
}
}
}
According to the documentation, this should be possible using dependent app requirements:
Some required resources, such as triggers or views, may depend on other resources in requirements.json. In these cases, use the resource's property key wherever the equivalent API payload would use the resource's id.
https://developer.zendesk.com/documentation/apps/app-developer-guide/apps_requirements/
However, in the documentation, we can find only a sample configuration with a reference for a custom target (an_email_target) by passing email target's property key when defining an action for the trigger.
For example, the following requirements.json file declares an email target and a trigger. The trigger references the email target's property key.
{
"targets": {
"an_email_target": {
"title": "A sample email Target",
"type": "email_target",
"email": "foo@bar.com",
"subject": "Hello, from this target!"
}
},
"triggers": {
"email_on_ticket_solved": {
"title": "Email on ticket solved Trigger",
"all": [
{
"field": "status",
"operator": "is",
"value": "solved"
}
],
"actions": [
{
"field": "notification_target",
"value": ["an_email_target", "Ticket {{ticket.id}} has been updated."]
}
]
}
}
}
Can I use the same approach for columns when defining views and referencing custom fields using property keys? Thanks!
-
Hi Miro! The short answer is, no, this will not work. The reason for that is when you're creating a view and adding columns for custom ticket fields, you need the field id, not the name of the field. Since the requirements file is creating the fields, there is no way to get that id beforehand, and thus it wouldn't be possible to add them in the view's columns.
Por favor, entrar para comentar.
1 Comentários