Using the IF THEN ELSE function

Return to top
Have more questions? Submit a request


  • Robert


    how do i get >3 only open tickets based on tag?

    IF (VALUE(Agent replies) =3
    NOT ([Ticket status - Unsorted] = "Hold" OR [Ticket status - Unsorted] = "Solved" OR [Ticket status - Unsorted] ="Closed"))
    THEN [Ticket ID]

  • Graeme Carmichael
    Community Moderator


    I would go for...

  • Robert

    I just want to get open tickets, how do I do that? 

    IF (VALUE(Agent replies) >3AND
    ([Ticket status - Unsorted] = "Open"
    [Ticket ID]

  • Graeme Carmichael
    Community Moderator


    Try this...

  • Isaac Y


    I'm trying to get the SLA of a certain region with certain group, but I want to exclude those ticket that has a custom tag. But it doesn't work, can any1 share some insight?

    IF ([Ticket group] = "XXX") 
    AND ([Region] = "XXX")
    AND (NOT INCLUDES_ANY([Ticket tags], "ticket_breached")
    THEN [SLA policy ticket ID]


  • Andrei Kamarouski

    Graeme Carmichael Eugene Orman

    Hi guys, 

    It seems that using attributes values directly in formulas is not working for proper calculations (I just receive all tickets instead of intended tickets with the non-blank value in my custom field).

    You are writing about using attributes in the formula, but showing examples with tags of those attributes. Is this the proper way to build metrics for custom ticket fields? The documentation is not clear here or do I miss something? 

  • Rob Stack
    Zendesk Documentation Team

    Hi Andrei Kamarouski, could you try removing the quotes from "NULL"? NULL isn't a value, it's essentially "nothing" :-) 
    There's a similar example of what you're trying to do in this article.

    I hope this helps, but do let us know if you need more help. Thanks!

  • Andrei Kamarouski

    Hi Rob Stack, I see now! =) Thx! 😊 

  • Adam Wideman

    I'm not sure if I'm doing this totally correct or if I need to make a whole different set of custom metrics to pull this off, but I'm trying to add some custom fields to my Organizations for "Service Agreements".  Each agreement, of which there are 3 for each organization possible, would have a "Contract Number", "Hours Purchased", and a "Contract Value".  I need to pull in Hours Purchased and Contract Number in order to run a query against how many "hours billed" against the "Hours Purchased".  I've been able to do this easily with just one contract, but now its causing some erroneous data when we have multiple contracts involved.  SO  I want a field thats SUPER smart.  I need one that knows to show hours purchased relevant to which Contract Number is used.  The matching field is called "Ticket Sage Reference" (also custom) and lives in the ticket.  I want to say something like

    IF ([Ticket Sage Reference]=VALUE(ContractNumber))
    THEN 1
    ELSE IF ([Ticket Sage Reference]=VALUE(ContractNumber2))
    THEN 2
    ELSE IF ([Ticket Sage Reference]=VALUE(ContractNumber3))
    THEN 3

    Then one that would ACTUALLY display the content

    IF ([CustomMetric]=1)
    THEN VALUE(ContractNumber1)
    ELSE IF ([CustomMetric]=2)
    THEN VALUE(ContractNumber2)
    ELSE IF ([CustomMetric]=3)
    THEN VALUE(ContractNumber3)

    I'm terrible with functions, please send help . I think I may even be at the point where I may even pay Zendesk to write this for me, but wanted to see if anyone could steer me in the right direction before i did that.


Please sign in to leave a comment.

Powered by Zendesk