Skip to main content

hi

i am trying to build an automatic flow and use the expression builder to read a value from the last written note.

The text that we are going to get is surrounded by this character "

Can you use excape characters to get the expression builder to understand which character it should, for example, replace?

For example. replace('Testing " if it " works',' " ','*') to replace " with *.

I get an error message that says
Invalid syntax - Missing right parenthesis

Makes sense! I’ve got this down as a potential enhancement for the expression builder. 


@vishal.abraham Thanks for passing this along to the product team. 💪


Opened a case yesterday for similar issue.  Trying to sanitize last name before account creation in AD to remove spaces, dash, single quotes, etc.  Also getting the invalid syntax error.


Opened a case yesterday for similar issue.  Trying to sanitize last name before account creation in AD to remove spaces, dash, single quotes, etc.  Also getting the invalid syntax error.

Have you tried using? Powerful Placeholders with Liquid Filters : Freshservice
remove – Liquid template language (shopify.github.io)
strip – Liquid template language (shopify.github.io)
 


Opened a case yesterday for similar issue.  Trying to sanitize last name before account creation in AD to remove spaces, dash, single quotes, etc.  Also getting the invalid syntax error.

Have you tried using Liquid Filters ? Introduction – Liquid template language (shopify.github.io)
The Remove and Strip filter. 


Opened a case yesterday for similar issue.  Trying to sanitize last name before account creation in AD to remove spaces, dash, single quotes, etc.  Also getting the invalid syntax error.

Tried using Liquid Filters? 


anyone get a solution on this?


Opened a case yesterday for similar issue.  Trying to sanitize last name before account creation in AD to remove spaces, dash, single quotes, etc.  Also getting the invalid syntax error.

Tried using Liquid Filters? 

I’m not sure what you are suggesting.  I can replace most characters just ASCII Code 39 is the issue because it gets interpreted as a string terminator.   In powershell I could use something like $string.Replace(gchar]39,””), but there doesn’t seem to be an equivalent.


I tried {{ "e3.result" | replace: “’”, "" }}.  No luck.  Invalid operand.  Then I saw regexreplace is available.  But that doesn’t seem to work either.  I can’t escape the single quote.

So if someone enters O’Grady instead of O`Grady (single quote instead of apostrophe) I can’t clean the string.  Problematic because AD and 365 will accept a userpincipalname or email address with those characters but as you try to push that out to other integrated systems they are often not accepted.


ok so I think my misunderstanding is that Liquid filters can be used in app actions, but they are not accepted in expression builder.


ok so I think my misunderstanding is that Liquid filters can be used in app actions, but they are not accepted in expression builder.

I think I got Liquid to work, you like to remove ‘ from a placeholder? 
You shouldn’t use "e3.result" it needs to be just e3.result 

What is your next step b/q you can use Liquid when you add the PH in a note, field or JSON payload. 

 

//Daniel


ok so I think my misunderstanding is that Liquid filters can be used in app actions, but they are not accepted in expression builder.

I think I got Liquid to work, you like to remove ‘ from a placeholder? 
You shouldn’t use "e3.result" it needs to be just e3.result 

What is your next step b/q you can use Liquid when you add the PH in a note, field or JSON payload. 

 

//Daniel

The next step is an expression that builds samaccountname which is then used to verify it does not conflict with an existing user and later to create JSON payloads for proxyaddresses, etc.

Correct trying to remove ‘ from a placeholder.  


If I could use escape from Liquid I could then use replace to get rid of '

escape – Liquid template language (shopify.github.io)


If I could use escape from Liquid I could then use replace to get rid of '

escape – Liquid template language (shopify.github.io)

What happens if you use sanitize_html ?

Powerful Placeholders with Liquid Filters : Freshservice


I tried {{ "e3.result" | replace: “’”, "" }}.  No luck.  Invalid operand.  Then I saw regexreplace is available.  But that doesn’t seem to work either.  I can’t escape the single quote.

So if someone enters O’Grady instead of O`Grady (single quote instead of apostrophe) I can’t clean the string.  Problematic because AD and 365 will accept a userpincipalname or email address with those characters but as you try to push that out to other integrated systems they are often not accepted.

Hello Timm, 
I know this is old but you should use the regexMatch or regexReplace expression node functions and not liquid filters for this. We have a script that builds expressions for the expression node to find a specific string based off selections we put in a condition node. We got hung up mainly on the fact that there are different characters that can be used in names and email and Office products love to put in smart quotes all the time.

You would really need to know which character you want first the straight single quote, apostrophe, or single smart quote. 
https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

Using the example provide by Jnstare Here is what you can do to replace anything that matches single quote, single smart quotes, double smart quotes, or double straight quotes with the * character

regexReplace('Testing " if it " works', 't\'\’\‘\”\“\"]', '*')
Picture of Expression Node using RegexMatch

For your example we can use the same but to change the star to a the the grave accent or ` which is what you were trying to use. 
Value used below was O’Grady which uses the single quote
Regex Used is 

regexReplace('{{value}}', '<\'\’\‘\”\“\"\`]', '`')
Picture of regex match for grave accent
Picture testing Regex pattern

Hope this helps


hi

i am trying to build an automatic flow and use the expression builder to read a value from the last written note.

The text that we are going to get is surrounded by this character "

Can you use excape characters to get the expression builder to understand which character it should, for example, replace?

For example. replace('Testing " if it " works',' " ','*') to replace " with *.

I get an error message that says
Invalid syntax - Missing right parenthesis

Hello Jnstare,

To answer your direct question, if you have something else that can add in an extra set of straight single quotes in your string you are evaluating with replace, that will act as an escape for you as well. 

replace('Testing "" if it "" works','""','*')
Direct string with escaped quotes
using placeholder value

Please note that using the value section in expression node sometimes doesn’t fully represent what is going to be fed into it as it seems that it requires only single set of double quotes when testing as if it escapes those characters itself when evaluating. So it is best to review what it is actually trying to evaluate by having it paste as a note in an action node before the expression node you can review the execution Logs to see what the placeholder turned into when it was being evaluated.

If you can’t do that you can try to use the method I provided earlier to Tim. Which is the regexReplace method instead:

Using the example provide by Jnstare Here is what you can do to replace anything that matches single quote, single smart quotes, double smart quotes, or double straight quotes with the * character

regexReplace('Testing " if it " works', 'k\'\’\‘\”\“\"]', '*')
Picture of Expression Node using RegexMatch​

 

Hope this helps in some way 


Reply


OSZAR »