Solved

Expression Builder with Liquid expressions.


Userlevel 7
Badge +11

Hello, 

Been testing the new Expression Builder block and found some ups and some downs. 

I created this expression using Liquid and the test gives me OK on it but I can’t save it. I get this when I click on done. 
Invalid Syntax - One of its operands is invalid.

 

{% assign home = "no" %}{% if {{home}} == "no" %}"no"{% else %}"yes"{% endif %}

 

 

My goal is something like this, create a 

{% if {{ticket.tag}} contains "ApprovalStep2" %}{{R3.approver1}},{{R3.approver2}},{{R3.approver3}},{{R3.approver4}}{% else %}{{R2.approver1}},{{R2.approver2}},{{R2.approver3}},{{R2.approver4}} {% endif %}

 

This is part of a Approval flow.  

My first action sets TAGS with this 

https://gist.github.com/varazir/f9c714f8193e45531e8c5fbcdc57e61b

Next action is to send approval message based on “to be approved by”-types there are. Using tags for conditions and don’t want to make 2 setups with send approval actions. 

 

( I wish there was a API option in the body when you send a note  “approveby”: “everyone” ) 

 

 

icon

Best answer by Daniel Söderlund 19 May 2022, 11:38

View original

34 replies

Userlevel 7
Badge +11

@zachary.king  I hope you hade a good 4th July.
How did it go with the Freshservice support ? 

Hey @daniel.soderlund, thank you. Was a nice weekend to get away. Regarding the Expression Builder, the issues has been escalated to the backend team to take a look at. No resolution as of yet, but once I have one I will be happy to share it here.

Hi, heard anything new on this ? 

Userlevel 7
Badge +14

Hello @daniel.soderlund, they are still working on it. it looks to be an issue with the liquid placeholders. So they have some engineers taking a look at it. Have not gotten a full resolution yet.

Userlevel 7
Badge +14

So after a decent amount of troubleshooting by the development team they were able to help me get an expression to work that achieved the result I was looking for. It appears that it required additional methods from the Liquid Language, in my case it was the “append” method. So my assumption with the difficulty using the expression builder and placeholders syntax is figuring out how much to alter with the Liquid Language and how much to use the expression builder’s functions.

@daniel.soderlund I hope that helps some, but it is still a little vague, I know.

Badge

Does any one else have an issue when you copy paste into the expression builder it removes all formatting ………. seems i can type all day long and hit enter but as soon as i paste…

And no undo options super frustrating

Maybe it’s just a firefox issue?

Userlevel 7
Badge +11

Does any one else have an issue when you copy paste into the expression builder it removes all formatting ………. seems i can type all day long and hit enter but as soon as i paste…

And no undo options super frustrating

Maybe it’s just a firefox issue?

What do you mean formating? Like new line and tabs? 
The node uses one line format. 

Badge

 

What do you mean formating? Like new line and tabs? 
The node uses one line format. 

Probably, one line format is frustrating. But odd it will let you hit enter all day long as long as you’re staying in the box.
 

Userlevel 7
Badge +11

 

What do you mean formating? Like new line and tabs? 
The node uses one line format. 

Probably, one line format is frustrating. But odd it will let you hit enter all day long as long as you’re staying in the box.
 

I tend to write my expression in notepad++ so I get it correct then I copy/paste it to the node. 

Badge

 

What do you mean formating? Like new line and tabs? 
The node uses one line format. 

Probably, one line format is frustrating. But odd it will let you hit enter all day long as long as you’re staying in the box.
 

I tend to write my expression in notepad++ so I get it correct then I copy/paste it to the node. 

That’s how i do it as well, but as janky as the expression builder is right now the ability to do a quick tweak on it would be great.

Also for when you need to edit, and copy it out from there later on………. it just seems silly to have a one line box there.


As long as it’s not just me ……..:) Thanks for the responses.

I was pretty proud of this one - it will search the {{ticket.description}} field and pull out the Client Name which it finds after the words “Client Name :”  and before “Environ”.  Works great!

 

substring('{{ticket.description}}', (indexOf('{{ticket.description}}','Client Name :',0)+14), indexOf('{{ticket.description}}','Environ',0))

 

Expected Output = String

Results = Company Name 



Hi there! This is exactly what I was looking for one of my automations, however, this always returns a non-breaking space (\U00A0) at the end of the result, any ideas on how to get rid of it? I’ve tried a bunch of liquid filters on the result and it just keep appearing sometimes.

Reply