Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Not Equals condition on flow to Case insensitive

So I currently have a custom attributes where I need to check parameters if not equals to the set attribute but I want the condition to be case insensitive. And it seems like using != operator doesn't work that way.

I have this on the Flow:

<Step>

<Name>EntityError</Name><Condition>(verifyapikey.Verify-API-Key.attr != "All") 
	and (verifyapikey.Verify-API-Key.attr !=  params.entity) 
</Condition>

</Step>
Solved Solved
1 9 1,753
2 ACCEPTED SOLUTIONS

You can use a JS policy before this step and then set a variable like "invalidAttr = true"; after validating your use case and use this variable check the condition in the next step.

Something like this:

const attribute = context.getVariable('verifyapikey.Verify-API-Key.attr') || '';
const invalidAttr = attribute.toLowerCase() !== "all" && attribute !== params.entity ? true : false;

context.setVariable('invalidAttr', invalidAttr);
<Step>
  <Name>EntityError</Name>
  <Condition>invalidAttr</Condition>
</Step>

View solution in original post

You can use regular expression matching in conditions.

<Condition>NOT (verifyapikey.Verify-API-Key.attr ~~ "(?i)All") 
	and (verifyapikey.Verify-API-Key.attr != params.entity) 
</Condition>

This expression : "(?i)All"

... is a regex that matches any form of "all" , case-insensitively.

View solution in original post

9 REPLIES 9