Solved

Expression Builder test works, but not in production

  • 4 January 2024
  • 2 replies
  • 46 views

Badge +5

Is anyone else experiencing this problem when building a workflow — the expression node will show during testing that a operation performed as expected, but during live ticket automations, the output is different and causes an error?

Expression node test result
 
Workflow automation execution result

 

I’m using the following expression to delete everything in ticket description except a string nestled between two specific delimiters:

regexReplace(regexReplace('{{ticket.description}}','^(.*?«)',''),'»(.*)$','')

So the input would be
Lorem ipsum dolor sit amet «ASDFGHJKL123» some other text

And the output would be
ASDFGHJKL123

I’ll try to find a workaround, but it makes setting up this workflow frustrating.

Any advice would be appreciated. Thank you!

icon

Best answer by zachary.king 5 January 2024, 15:29

View original

2 replies

Userlevel 7
Badge +16

Hello @christian.mentor, So is your question regarding the fact that there are BR tags in the output? you could try using a liquid filter to strip the html from the output. The description filed contains html and that does not get sanitized as you pass it down the workflow.

Try using this liquid filter around the expression builder result

https://shopify.github.io/liquid/filters/strip_html/

If that is not what you are referencing I apologize. A great way to make sure you are getting the right value when testing through the entire workflow is to have the expression result post to a ticket as a note, then you will be able to verify what is actually being passed as a “string”. I didn’t see it in your expression node but I assume the return type is of type “String”. Hopefully using a liquid filter helps get what you are looking for.

Take care!

Badge +5

Hello @christian.mentor, So is your question regarding the fact that there are BR tags in the output? you could try using a liquid filter to strip the html from the output. The description filed contains html and that does not get sanitized as you pass it down the workflow.

Try using this liquid filter around the expression builder result

https://shopify.github.io/liquid/filters/strip_html/

If that is not what you are referencing I apologize. A great way to make sure you are getting the right value when testing through the entire workflow is to have the expression result post to a ticket as a note, then you will be able to verify what is actually being passed as a “string”. I didn’t see it in your expression node but I assume the return type is of type “String”. Hopefully using a liquid filter helps get what you are looking for.

Take care!

Thank you, @zachary.king! A very astute observation — I noticed the html tags in the output too (for some reason, only when you hover over it?) and thought the regex expression would’ve caught that as it did the content preceding the “«” character.

However, now that you mentioned it — makes sense that wouldn’t register as part of a “String” during the workflow. Your suggestion worked like a charm.

Much appreciated and thanks for lending your expertise!

Reply