Add metadata to custom field, custom app

5 Comments

  • Ahmed Zaid
    Community Moderator

    Hi Mike Larsen,

    That sounds interesting. It will have the limitation of syncing only one comment though which may not be the one you are interested in.

    0
  • 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
  • Mike Larsen

    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
  • Patrik Kaldi

    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
  • 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

Please sign in to leave a comment.

Powered by Zendesk