I’ve been trying to make simple workflow (but with a kind of a complex Compare Strings step) to work properly. But so far, no luck. Let me explain all of the context.
We want to to create a workflow with a Get Identity step in which we want to test (using the Compare Strings step) if the “cloudAuthorithativeSource” attribute’s value retrieved from the Get Identity step, matches one source id or another source id from our tenant. Let’s have a look at the workflow itself:
As you can see in the value1 parameter of the comparator step we defined the following correct jsonpath: $.getIdentity.attributes[?(@.cloudAuthoritativeSource == ‘2c9180887f4cbd02017f5ad9de465cb1’ || @.cloudAuthoritativeSource == ‘2c91808a7e78ccef017e7901d4260195’)].cloudAuthoritativeSource —> this will return the following value (as we can see in any Json Path evaluator):
That array containing the value of the source long id, is the exact same result that our value2 parameter, which is the following: $.attributes[?(@.cloudAuthoritativeSource)].cloudAuthoritativeSource, which will also return the following value (as we can see in any Json Path evaluator):
In this case then, to me, if the two values returned from each jsonpath in value1 and value2 is the exact same value, it should return true. But when I execute the workflow it returns false, which souldn’t:
If anyone knows what could be happening, it would be much appreciated to receive support or advice. Thanks you all!, and best regards.
The JSONpath implementation that is used in Workflows is a limited version of Goessner that does not support logical operators (i.e. && and ||). Attempting to use logical operators will result in no value being returned by the JSONpath, hence the always False condition.
Workflows has changed its JSONpath implementation to JSON Slice (GitHub - bhmj/jsonslice: json slicer) which allows for logical operators. You should now be able to use logical operators in your JSONpath expressions.
Thank you Colin for your response. Would you mind to advise me any other possible way to do what I’m trying to do, without using multiple comparing steps for each source id value to be tested?
Unfortunately, you will need to create multiple compare steps for the time being until engineering adds support for logical operators in the compare steps. I don’t know when logical operators will be supported, but they are coming.
We also have a similar requirement on the compare strings as yours so is the json bodies you are giving in the compare strings without logical operators works.?
Like we are also using the compare strings and we have two json bodies in two values of compare strings the check is ‘Equals’ both the json return same value but the compare string always goes to false path.
We want to know if that is working for you.?
Value one : $.accountRequests[*].attributeRequests[?(@.attributeValue==“CheckValue”)].attributeValue
Returns : [CheckValue]
Second Value (Choose Variable) : $.accountRequests[].attributeRequests[].attributeValue
Returns : [CheckValue]
Inspite of going to true ‘compare strings’ always goes to false path…Any thoughts on this.?