Update organization fields with webhook or API

5 Comentarios

  • Ahmed Zaid
    User Group Leader Community Moderator
    Zendesk Luminary

     Hi Alfredo Guillem Fernández-Hidalgo,

    A trigger can check if organization field is present and perform an action on it. It works well with text fields. Here is an example of the condition and action needed (to add to your existing trigger conditions)

    Where {{ticket.ticket_field_123456789}} is a placeholder for the value of the ticket custom field. Replace 123456789 with the field id from the admin center:

     

    Note that other field types are not suitable for this solution and will require a workaround. This also depends on the ticket being assigned to the organization through the requester's membership.

    0
  • Alfredo Guillem Fernández-Hidalgo

    Hi Ahmed Zaid this solution doesn't work as the trigger copies the text {{ticket.ticket_field_123456789}} into the organization field as is, without substituting it by the actual value

    0
  • Ahmed Zaid
    User Group Leader Community Moderator
    Zendesk Luminary

    Hi Alfredo Guillem Fernández-Hidalgo,

    My mistake. I didn't test this myself. Setting field values in trigger actions does not seem to support liquid markup, but webhook notification payload certainly does. So here is your webhook configuration:

     

    The endpoint should be

    https://subdomain.zendesk.com/api/v2/organizations/{{ticket.organization.id}}

    So instead of setting the field value directly in the trigger action, you will instead notify the webhook you just created with this payload:

    {
      "organization": {
        "organization_fields": {
          "company_id": "{{ticket.ticket_field_123456789}}"
          }
      }
    }

    This time I tested it myself and it works. I hope this helps.

    0
  • Persistent Dev


    Hi,

    I am trying to add organization_fields by Updating my existing organization id. below is my payload what I am trying to do with my request url, It gives me 200 OK response but organization_fields shows empty in the response records. Why isn't my organization_fields updating?

    curl --location --request PUT 'https://{subdomain}.zendesk.com/api/v2/organizations/22179363925523' \
    --header 'Authorization: Bearer 8c4448cc5caae330c26c493c42101************************' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "organization": {
            "organization_fields": {
                "org_1": "org_field1",
                "org_2": "org_field2"
            },
            "notes": "This is for org",
            "group_id": 22151672976147
        }
    }'

    Response:

    {
        "organization": {
            "id": 22179363925523,
            "name": "My Insert2 Organization",

            ..

            ..

             "tags": [],
            "organization_fields": {}
        }
    }
    0
  • Aleksandrs Galiullins
    Zendesk Customer Care
    Hi Persistent Dev,
     
    I was able to update organization fields as in your example/scenario, please see the attached screenshot as example.
    Further clarification is needed in your use case, what type of the fields "org_1" and "org_2" (text, milti-line or drop-down) is used?


     
    I'm going to open a support ticket with you about your issue, where we can collobarate further.
     
    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk