I was trying to build a workflow with the WorkFlow Builder method.
Expectation: Workflow should be triggered only when user’s cloudLifecycleState status is changed to inactive.
Observations: But we see that even after creating a filter and workflow, it triggers when any changes is made to the cloudLifecycleState attribute.
Please find the attached screenshots to find the details on the workflow configured.
Could you please let me know if what i am following is correct and any pointers on this would help.
I have followed the below documentation provided regarding the workflow.
The JSONpath in the Compare Strings is invalid. It should be
$.trigger.changes... instead of
$.changes.... But using a Compare Strings step to filter events is not the recommended approach, as it is very inefficient and will lead to a high load of workflow executions. You want to put the filter on the trigger itself so the workflow only receives events that meet your criteria.
Try copy/pasting the filter from the Compare Strings step into the Filter text box of the trigger as-is.
You can also remove the Compare Strings step since it won’t be necessary once the filter is on the trigger.
Tried both the ways as per the suggestion.Please find the below observations.
- When added the JSONpath of Compare Strings with $trigger.changes, the workflow was triggered when user’s lifecyclestate attribute was changed
- Also just added the filter as-is in Filter path and removed Compare String step, the workflow again did not trigger when user’s lifecyclestate attribute was changed
Note: Tried with filter with both $.changes and $.trigger.changes.
Is this correct? Please let me know why the workflow is not getting triggered.
Also we have observed that the working workflow (basic one) also stops working suddenly for sometime. Is there any reason for the same?
Kindly request you to guide me through this
Your trigger filter should be this:
$.changes[?(@.attribute == "cloudLifecycleState" && @.newValue == "inactive")]
I used the same filter on a workflow and I was able to get events when the newValue was inactive. One thing to check is if your workflow is enabled. Make sure you enable it in the main menu:
One question here, wont the Successful Runs count increase whenever the workflow is run?
Yes, it should. This is a known issue that is being worked on.
Thanks a lot, for the information