Is it possible to write an expression with nested IF?
I want to extract a case number from the subject, but the sender sends emails with three different subjects.
My thought was to write a function that checks if the beginning of the subject is XXX, then it should extract in a way. If the subject starts with YYY instead, it must extract in a different way. And if the topic starts with ZZZ, it should extract in a third way.
Something like this:
if(startsWith('{{ticket.subject}}','XXX'),
substring('{{ticket.subject}}', indexOf('{{ticket.subject}}','XXX',0)+length('XXX '), indexOf('{{ticket.subject}}',',',indexOf('{{ticket.subject}}','XXX',0) ) ),
if(startsWith('{{ticket.subject}}','YYY'),
substring('{{ticket.subject}}', indexOf('{{ticket.subject}}','YYY',0)+length('YYY '), indexOf('{{ticket.subject}}',';',indexOf('{{ticket.subject}}','YYY',0) ) ),
substring('{{ticket.subject}}', indexOf('{{ticket.subject}}','ZZZ',0)+length('ZZZ '), indexOf('{{ticket.subject}}',':',indexOf('{{ticket.subject}}','ZZZ',0) ) )
)
)