Filter on Identity Lifecycle State Changed Trigger

I would like to set up a workflow that’s triggered when LCS changes from "inactive" or "delete" to "active" and I was hoping to use this relatively new trigger “Identity Lifecycle State Changed”. But I am not able to figure out the filter to be applied to limit the execution to the condition described above.

JSON Input from the trigger is in the format

{
  "identity": {
    "id": "ee769173319b41d19ccec6cea52f237b",
    "name": "john.doe",
    "type": "IDENTITY"
  },
  "oldLifecycleState": "preHire",
  "newLifecycleState": "active"
}

Does it behave different if you use double quotes instead of single quotes?

If that doesn’t make a difference, I might still try to use the Identity Attribute Changed trigger, I’ve had success using something like this:

$.changes[?(@.attribute == "cloudLifecycleState" && @.newValue == "terminated") && ($.oldValue == "inactive" || $.oldValue == "delete")]

check this

"filter.$": "$.changes[?(@.attribute == \"cloudLifecycleState\" && @.newValue == \"active\" && @.oldValue in [\"terminated\", \"inactive\"])]",

$.changes[?(@.attribute == "cloudLifecycleState"

is for Identity Attributes Changed trigger

try this

$[?(@.newLifecycleState == 'terminated' && (@.oldLifecycleState == 'inactive' || @.oldLifecycleState == 'delete'))]

Thanks @kalyan_dev32
I cannot utilize [?(@. )] format as the input json is not an array.

Yes, the input is not an array. However, I’ve verified it with the event trigger filter, and it’s working as expected. Refer below screenshot.

2 Likes

Thanks @kalyan_dev32

I am assuming there is a $. in the beginning of your filter string. It still does not work

Also, I am seeing this error in the workflow


I believe you should use this filter


$[?(@.newLifecycleState == 'terminated' && (@.oldLifecycleState == 'inactive' || @.oldLifecycleState == 'delete'))]

Filter you can use.

$.changes[?(@.attribute == 'cloudLifecycleState' && @.oldValue == 'active' && (@.newValue == 'termPending' || (@.newValue == 'inactive'))]

Just use the identity one. Thats is what i would do.

1 Like

@iamnithesh, Give this a shot, I recently worked on something similar.

$.[?( (@.newLifecycleState == ‘terminated’) && (@.oldLifecycleState == ‘prehire’ || @.oldLifecycleState == ‘active’) )]

@iamnithesh you can validate/generate the filter using this endpoint.

Even though it says to test subscription filter I usually use this to generate the filter that can be used in workflow trigger.

For your input if I use the below filter it says as valid

"filter": "$.[?((@.newLifecycleState == \"active\") && (@.oldLifecycleState == \"inactive\" || @.oldLifecycleState == \"delete\"))]"


You can also play around by passing different values and see if the filter is working as expected or in your postman itself.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.