Workflows: check if list is empty

I am using a workflow to deprovision requested access profiles from terminated users, however am having a difficult time filtering the workflow to check if the $.getAccess.accessItems array returned in the “Get Access” Action is empty or not. In other words, if the array returned is empty meaning there is no access to deprovision, the workflow should end.

Is there a way to use the compare operator or any other operator to compare and check if the array returned by the “Get Access” action is empty or not?

Thanks!
Sebastian

There is! A recent update to Workflows JSONpath has brought support for many new JSONpath operators. In this case, you can use the length() operator in a Compare Numbers step to check for an empty list. Just replace the Value 1 JSONpath as follows:

$.getAccess.accessItems.length()

1 Like

That’s great! I tried this a couple of weeks ago so it has to have been in the latest rollout for workflows :slight_smile: Thanks, gonna try this now.

Yea, this was rolled out last week. You just missed it :slight_smile:

Ahh! Has it been rolled out to production environments as well?

Yes, it should be in prod as well.