최근 검색


최근 검색 없음

Condition Statement in webhook body

답변함


2024년 1월 18일에 게시됨

Hi Folks, probably something easy I'm missing, but I have a trigger that calls a webhook to post an internal comment to my ticket with the content of our Org Notes field.

Right now this would post even if that field is empty and I'd like to find a way to not post anything if the field is blank.

I'm thinking I need an if statement somewhere in here, because I can't see a way to do it with the trigger


{
"ticket": {
"comment": { "body": "{{ticket.organization.notes}} ", "public": false }
}
}


0

1

댓글 1개

image avatar

Brandon Tidd

Zendesk LuminaryUser Group LeaderThe Humblident Award - 2021Community Moderator

Hey Shane Weber

You're correct!  Zendesk uses liquid markup here, so you'd need something along these lines:

Check variable is defined and not null

In Jekyll, an if statement on a variable will be truth if:

  • The variable is defined (i.e. declared, not missing).
  • The variable is not null.
{% if my_var %}
    {{ my_var }}
{% endif %}

Warning - this check will return true even for a value that is a zero number, an empty string, or an empty array.

Check that number is non-zero

{% if my_int and my_int != 0 %}
    {{ my_int }}
{% endif %}

Check that string is not empty

{% if my_str and my_str != '' %}
    {{ my_str }}
{% endif %}

0


댓글을 남기려면 로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물