Búsquedas recientes
No hay búsquedas recientes
Display custom fields from a query of multiple tickets
Publicado 16 ago 2021
Hello! I've done a lot of python work with the Zendesk REST API, but am new to the javascript side of things in ZAF.
Here is what I want to do; Make a sidebar app that:
1. Retrieves Custom field value from ticket.
2. Queries for all tickets with that same value
3. Loop through those tickets extracting some other custom field values and displaying them in the app in table form.
1. I have built the app and retrieved the custom value
2. looking for code snippets or resources for how to do a query and put it into an array of ticket ids.
3. looking for code snippets or resources on how to loop through that array, doing individual queries of those tickets for custom field values and putting those into this idea from the code samples:
function showInfo() {
var requester_data = {
'name': 'Jane Doe',
'tags': ['tag1', 'tag2'],
'created_at': 'November 20, 2014',
'last_login_at': 'June 27, 2016'
};
End result I'm looking for is an App in right sidebar that looks like this:
CUSTOM FIELD RELATED TICKETS
Ticket#. Custom Field. Custom Field. Custom Field
Ticket#. Custom Field. Custom Field. Custom Field
Ticket#. Custom Field. Custom Field. Custom Field
Thanks for any help or pointers!
0
4 comentarios
Tipene Hughes
Hey Raven Agape,
Thanks for reaching out!
One possible way you could go about this is by using the client.get() method to retrieve the custom field value, and then using the client.request() method in conjunction with the Search API to query all tickets based on the custom field value. Here’s a code snippet I put together which will achieve that:
This will return an array of ticket objects which you can then iterate over to determine if they have additional custom field with values.
I hope this helps! Feel free to reach out with any questions.
Tipene
0
Raven Agape
Thank you so much! This has really put me on the right track.
Can you give me a pointer on how to parse the array?
Here is what I get back:
I tried various like [4] or results.body or results.text.... I can see in the console the full array, but I can't find the syntax for digging into the individual tickets and their subsequent field values.
Any help appreciated!
0
Tipene Hughes
I'm glad it's got you moving in the right direction!
Here's an example that might help you pull the field values from the array:
I hope this helps! Let me know if you have any questions.
Tipene
0
Raven Agape
this did the trick, forgot to come back and say "Thanks!!!"
0