Recent searches


No recent searches

Pulling custom Org fields into ticket

Answered


Posted Mar 01, 2018

Has anyone tried or accomplished being able to pull information from custom organization fields to display in a ticket? 

 

eg: if for Customer ABC I have a custom field in the Organization profile where IT information is supplied, is there a way to put that info into every ticket as read-only? 


2

17

17 comments

image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Dena,

I've done similar things in the past. One simple(ish) way to do this would be to use the placeholder for your custom org field as a private message in a macro and have your agents apply that macro when they want to pull up that information.

Something like this

Note you would need to update the cool_user_field part above with the field id from your custom organization field.

Alternatively, if you would rather have the whole thing automated, you could use a trigger or automation and an external target to update a field(s) via the API. Here is an example for a similar use case that I've used in the past. I think that would work. Such a workaround, however, is not recommended by Zendesk since there are potential conflicts that can prevent it from working reliably. 

Hope that helps you out and welcome to the Zendesk community.

0


I do something similar

Firstly, you’ll need to go into Settings -> Extension and setup a new HTTP target.

  • URL:  https://<your domain>/api/v2/tickets/{{ticket.id}}.json
  • Method: put
  • Comment type: JSON
  • Authentication: whatever

Then you’ll need to create/update a trigger with:

 

Notify Target: what whatever you called your HTTP target

JSON body

 

{

    "ticket": {

 

 

        "comment": {

            "public": false,

            "body":  "This customer is a member of:  \n {{ticket.requester.notes}}"

 

        }

    }

}

 

If it’s a custom field on the Org. then then you’ll need to refer to it as:

{{ticket.organization.custom_fields.<whatever the field is called>}}

 

 

Hope that makes sense

0


image avatar

Jessie Schutz

Zendesk Customer Care

Thanks for sharing, Lester!

0


I'm trying to do something similar to what Lester showed. I want a custom Ticket Field filled in whenever a certain custom(?) Organization Field is filled in.

I have the HTTP Target setup (no authentication set), but the Trigger or its JSON are illuding me.

I've set the ANY Conditions to "Status Is New" and "Status Greater than New" to hopefully make it trigger anytime.

The JSON is currently this:


{
    "ticket": {
        "{{ticket.ticket_field_360003547754}}": "{{ticket.organization.organization_fields.instance}}"
        }
}

I also tried this:

{
    "ticket": {
        "{{ticket.ticket_field_360003547754}}": "{{ticket.organization.custom_fields.instance}}"
        }
}

What's confusing is that when I look at the actual JSON for the ticket, "ticket_field_360003547754" is actually more like "custom_fields.0.id.360003547754" or "custom_fields.360003547754." This confusion is further exacerbated because the JSON for the Organization I'm testing with shows "organization.custom_fields.instance" should probably be "organization.organization_fields.instance."

I'm hoping some combination of the above is correct and it's the authentication that's causing the issues. However, if that's the case, it leads to a second question: what do I put if we're using Google for authentication? My G-Suite credentials?

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Randy,

I may be out of my depths here, but I'm wondering what are the two field types (drop-down, text etc.) you want to pull the value from, and put the value to?

A simpler trigger setup should be able to perform an update action to your custom ticket field based on a particular or any value present in your custom org field - in some cases anyway.

About the SSO authentication issue, I believe this post answers that.

0


Hi Jacob,

It's a text field to a text field. Unfortunately, the simpler trigger won't work because the available actions do not include setting custom ticket fields. If they did, this would be very easy.

Unfortunately, while the linked article appears to be helpful, it is not solving the authorization issue. I will probably reach out to ZD support to get a better handle on this.

Thanks!

 

Update: I followed another link to an Intro to the Core API. They have an example I looked right past because it was using curl... So, I don't yet have the Trigger working, but the Extension now connects.

The HTTP Target "UrL" needs to have the full URL, plus

 -u name@email.com/token:api-token-generated-by-zendesk

and then you don't need Basic Authentication enabled.

0


@Randy.

Were you able to successfully achieve this?

I'd really like to copy the Organization (custom) field down to a Ticket (custom) field... but cannot work out the correct syntax.

I've got lots of other targets/triggers working successfully, but this one is not clear in the API docs.

0


Hi Mark,

No, I was not. And, unfortunately, if I remember Zendesk's response, it's currently impossible and if you do manage it, it's not supported. The reason was something silly like a field merge issue... Even though my requires are explicit in regards to when the Ticket Field is set...

The only solution is to use Tags. Doing so is not pretty; it requires duplicate setup and doesn't work if anything changes (i.e. the value in the Org field changes, the Ticket field in an old ticket doesn't update). However, for all new tickets, it's flawless. We needed this functionality for two different fields. One is fairly constant and just under 100 values, so we went with the Tags solutions. However, the other would have required an ever-evolving list of over 800 values; we gave up on that and just refer to the Org field...

 

0


Hey Mark and Randy,

I was able to figure this out after Googling and Frankensteining a couple Community posts together.

The json used in my trigger was:

{"ticket":
{"custom_fields":

[{"id":custom_ticket_field_id,
"value":"{{ticket.requester.organization.custom_fields.field_key}}"}]


}
}

The bolded portions are what you should be filling out with a custom value.

For the ticket, the id is the custom field ID

For the organization, however, the field key is NOT the field id. You have to go to Manage > Organization Fields and use the Field key that pops up on the right when you click on an organization field.

Let me know if this works out for you guys.

0


@Martin

Thanks for looking into this. I've got it to work!! What a genius :) Here's what my trigger looks like.

{"ticket":
{"custom_fields":

[{"id":24090935,
"value":"{{ticket.requester.organization.custom_fields.test}}"}]


}
}

0


Thanks for the info in this thread folks - it works!

Couple of things to be aware of:

  1. Make sure the 'type' of the organization field and ticket field is the same (e.g. both 'decimal')
  2. The HTTP target must be 'PUT' method to update a ticket
  3. You can use 'basic auth' credentials in your HTTP Target settings with an API token - the 'Username' field should be an email address for a full agent account in the form: YOUR_EMAIL/token (note the '/token' after the email address) and the Password field will be a Zendesk API token that you have created. 

0


image avatar

Nicole Saunders

Zendesk Community Manager

Thanks for sharing those pointers, Tom!

0


Hello Everyone,

I tried to use the rules/workflow described here to copy an Org value to a ticket value without success.

These are my triggers and HTTP target:

 

Based on my rules, I want to notify an HTTP target with this trigger:

{
"ticket": {
"custom_fields": [{
"id": "{{custom_ticket_360006439420}}", // my custom ticket filed 
"value": "{{ticket.requester.organization.custom_fields.customer_acv}}" //my org field
}]
}
}

And I created a target like that:
URL is: https://MYDOMAIN//api/v2/tickets/{{ticket.id}}.json

 

However it i snot working, do you know why?

0


image avatar

Dan Ross

Community Moderator

Hey Alexandre,

You need to enable authentication on the target. If you're trying to update a zendesk ticket via the API, you need to have access to do so. 

By providing a username/password for the user that will be performing the update to the ticket, you should be able to proceed.

0


Hello Dan,

Thank you for your update, I still no more have issue regarding authentication. I have no more error also. However the value from organisation filed is not copied to my ticket field.

 

Trigger will call an external target with this:

 

{
"ticket": {
"custom_fields": [{
"id": "{{custom_ticket_360006439420}}", // my custom ticket filed (type numeric)
"value": "{{ticket.requester.organization.custom_fields.customer_acv}}" //my org field (type numeric)
}]
}
}

And I created an HTTP target like that:
https://Domain/api/v2/tickets/{{id}}.json+-u+myemail@mydomain.com/token:MyToken

Instead of https://Domain/api/v2/tickets/{{ticket.id}}.json+-u+myemail@mydomain.com/token:MyToken

Do you know what is going wrong here?

0


image avatar

Dan Ross

Community Moderator

Hey Alexandre,

Happy new year!

 

Can you try {{ticket.organization.custom_fields.customer_acv}} instead? The placeholder docs show these two methods as being the way to get to that data. 

ticket.organization.custom_fields.<key_name>

ticket.organization.custom_fields.<field_key>.title

 

Let us know how it goes!

0


Hi.

Thanks everybody to give me that excellent idea!

I fill a ticket field using extension option:

The URL is my domain on zendesk as:

https://domain.zendesk.com/api/v2/tickets/{{ticket.id}}.json

Then on the message body I put the sentence:

In this way I put a text value on the text ticket field.

You also can take this value on an other ticket field.

Thank you guys!!!!.

Maria

0


Post is closed for comments.

Didn't find what you're looking for?

New post