Vor Kurzem aufgerufene Suchen


Keine vor kurzem aufgerufene Suchen

Add metadata to custom field, custom app



Gepostet 09. Aug. 2022

We find metadata to be interesting and helpful. But the metadata is a bit hidden within the comment and it cannot be shared to another application (e.g., Jira) because it is not a field.

So our goal is some combination of the following
- modify the value of a custom field, named 'Metadata' and would have a specific Field ID
- upon ticket creation, the field would receive the metadata value(s)
- if for some reason the field already holds a value, do not overwrite
- upon subsequent edits to the ticket or comment additions, do no change or modify the field

The metadata values of interest:
metadata.system.client
metadata.system.ip_address
metadata.system.location

And the value written to the field would look something like:
Browser Client: {browserClient}
IP Address: {ip}
Location: {location}

We've found a custom app and modified it slightly to better suit our needs. But the app just appends the metadata to a comment rather than to a field. And the metadata is added to each and every comment. We just want to put the first comment's metadata into a field and that's all. The custom app is here and it works (but with the limitation mentioned):
https://github.com/eric-at-zd/metadata-writer

Is anyone up to create a version of the app which modifies a specific field? If we had the code, we could generate our own version of the custom app which modifies our specific field (by Field ID or by field name).

Thanks!


0

4

4 Kommentare

image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Mike,

I've thrown together a branch that showcases how to save the data to custom fields. You can see that here.

Thanks!

0


Thanks Eric

I can see how this can work. fieldGetter is important and the if/try logic is too.

Just making some notes here...

- For our needs, we'll have one field. So "metadataField" rather than one for ip and another for client
- 123 should be replaced with the specific field ID in "(obj) => obj.id === 123", e.g. field id 7779379345427 in the sandbox.
- I wonder if there is a way to base it off the field NAME instead. That way we have one implementation for both our sandbox and production environment. Perhaps obj.name or something. Both environments will have a field named "Metadata", but the field ID will differ in both because it is auto-assigned.
- Yes, this is meant to sync just one comment - the first comment, which may be from the end user and tends to be the most useful/interesting.

Thanks again. We'll try it out and maybe ask for some more advice or report good news.
-Mike

0


Dear Eric Nelson,

First of all thank you very much for your help . The app is working like a charm !

We would like to make it a bit suitable for our needs . We would like to gather also the location of the requestor not only the client and ip . 

I couldn't find any documentation about the data types which can be gathered as metadata . 

I tried something like

"locationClientField = location.value;
  ipField = ip.value;
  browserClientField = browserClient.value;" 

without success . 

If you could link the appropriate page of the documentation that would be awesome . 

Thank you in advance ,

Patrik Káldi

 

0


image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hi Patrik Kaldi,

In the context of the example app linked above, you could access the location using the following:

let location = metadata.responseJSON.comments[0].metadata.system.location;

You can read more about ticket comments and the metadata property here.

Thanks!

Tipene

 

 

 

0


Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Sie finden nicht, wonach Sie suchen?

Neuer Post