I am just sorting through my (hopefully) last issue on my workflow for connecting Dialpad with our PSA. At this stage of the workflow, I’m searching for any open tickets belonging to a contact and using an IF to determine the next steps. Originally I had it set up so that if more than 1 ticket was found, it would create a new ticket and if only 1 ticket was found, it updates the existing ticket. This didn’t take into account if there were no open tickets and so now I’m faced with trying to tackle both scenarios through one IF. If there are no open tickets, I get this result from the endpoint:
[
{
"tickets":[
],
"meta":{
"total_pages":1,
"page":1
}
}
]
If I get more than one result, I get this from the endpoint:
[
{
"tickets":[
{
"id":111,
"number":1234,
"subject":"Test",
"created_at":"2021-04-07T10:33:21.818-06:00",
"customer_id":1111,
"customer_business_then_name":"Not So Clever Admin",
"due_date":"2021-04-10T10:33:21.809-06:00",
"resolved_at":null,
"start_at":null,
"end_at":null,
"location_id":null,
"problem_type":"Windows",
"status":"New",
"ticket_type_id":null,
"properties":{
},
"user_id":222,
"updated_at":"2021-04-07T10:33:21.958-06:00",
"pdf_url":null,
"priority":"2 Normal",
"comments":[
{
"id":141805757,
"created_at":"2021-04-07T10:33:21.744-06:00",
"updated_at":"2021-04-07T10:33:21.827-06:00",
"ticket_id":111,
"subject":"Initial Issue",
"body":"Ignore",
"tech":"Clever Admin - MT",
"hidden":false,
"user_id":24223
}
],
"user":{
"id":666,
"email":"[email protected]",
"full_name":"Clever Admin - MT",
"created_at":"2015-11-27T13:15:09.066-07:00",
"updated_at":"2021-04-06T21:49:04.186-06:00",
"group":"Admins",
"admin":true,
"color":"DEBB27"
}
},
{
"id":222,
"number":2222,
"subject":"Test",
"created_at":"2021-04-07T10:32:31.049-06:00",
"customer_id":1111,
"customer_business_then_name":"Not So Clever Admin",
"due_date":"2021-04-10T10:32:31.038-06:00",
"resolved_at":null,
"start_at":null,
"end_at":null,
"location_id":null,
"problem_type":"Windows",
"status":"New",
"ticket_type_id":null,
"properties":{
},
"user_id":666,
"updated_at":"2021-04-07T10:32:31.715-06:00",
"pdf_url":null,
"priority":"2 Normal",
"comments":[
{
"id":141805585,
"created_at":"2021-04-07T10:32:30.973-06:00",
"updated_at":"2021-04-07T10:32:31.681-06:00",
"ticket_id":111,
"subject":"Initial Issue",
"body":"Ignore",
"tech":"Clever IT - Moez Tharani",
"hidden":false,
"user_id":24223
}
],
"user":{
"id":666,
"email":"[email protected]",
"full_name":"Clever Admin - MT",
"created_at":"2015-11-27T13:15:09.066-07:00",
"updated_at":"2021-04-06T21:49:04.186-06:00",
"group":"Admins",
"admin":true,
"color":"DEBB27"
}
}
],
"meta":{
"total_pages":1,
"page":1
}
}
]
Is it possible for me to perform an IF against both scenarios and basically “true” if there is only 1 ticket result and “false” if there is more than 1 or none?