Problem with string comparison step

Hello everyone

I’m creating a workflow so that when the “Identification Manager” attribute is updated, the workflow is triggered, but my validation always returns false.

My test

{
“identity”: {
“id”: “1c9abae01ee9400fa100d3c3788888”,
“name”: “john.doe”,
“type”: “IDENTITY”
},
“changes”: [
{
“attribute”: “identificationManager”,
“oldValue”: “sales”,
“newValue”: “marketing”
}
]
}

result

Hey @guilherme_sec,

I see that you are fetching the identity and comparing identity values. I believe what you actually need is to compare the trigger value directly with the identity value.

You might want to do something like this:

Alternatively, you can add the filter directly in the Trigger itself:

$.changes[?(@.attribute == 'identificationManager'  && @.oldValue == 'sales' && @.newValue == 'marketing')]

hope that helps!

Hi Guilherme,

The comparison is not working because the type of input in Value2 is “Enter Value”, not Choose Variable, so its comparing the variable from trigger with the STRING "$.getIdentity.attributes.identificationManager[?(@.attributes == "manager")].oldValue".
if you want to use a variable on Value 2 using the Enter Value, the {{ in the begin and }} in the end might resolve this problem

But helping you with this validation, the trigger identity attribute changed only returns attributes from identity that has changed, it doesn’t return all attributes from identity, so comparing the oldValue and the newValue to validate if they’re differente will always pass for this reason

maybe you can validate if the newValue for this attribute exists, as the trigger is getting 3 attributes I deduce that you want to validate if theres a change on this three attributes together, so there will be 3 compare strings with one attribute for each compare string

Complementing my answer, the getIdentity doesnt have .oldValue neither .newValue, so it’ll return an error trying to get this value from getIdentity or it’ll result in false as the workflow execution did