ISC: start a workflow using regular expression

Hello,
In our environment we have many Access Profiles following a naming scheme similar to XX: Outlook - Mail box [DIS].
When a user makes a request for one of those access profiles I want to start a workflow. So I use this filter for the trigger:

$.requestedItemsStatus[?(@.name =~ /.*Outlook - Mail box [DIS]/ && @.operation == “Add” && @.approvalInfo.[0].approvalDecision==“APPROVED”)]

It seems that the trigger doesn’t work when regular expressions are used.

Regards,
Giuseppe

Hello @GiuseppeDe , you can use Access request submitted event trigger and then call a workflow. In the workflow you can use Exists operator to determine above regex exists in the trigger or not, If it exists then you can execute the workflow actions .

Hello Prasad,

The first step in my workflow is the trigger Access Request Decision with the filter *$.requestedItemsStatus[?(@.name =~ /.Outlook - Mail box [DIS]/ && @.operation == “Add” && @.approvalInfo.[0].approvalDecision==“APPROVED”)].

If I understand your solution, the first step of the workflow should be the trigger Access Request Decision without any filter or just a simple filter like $.requestedItemsStatus[?(@.operation == “Add” && @.approvalInfo.[0].approvalDecision==“APPROVED”)], this way the workflow would practically act for any approved provisioning request.

Regarding the Verify Data Type operator I’m not sure how to use it, because the name of the access in the Access Request Decision is a sub entry of the element of the array and may be one of the following values: AA: Outlook - Mail box [DIS], CK: Outlook - Mail box [DIS], ZA: Outlook - Mail box [DIS], etc. Should a regular expression be used?

Regards,
Giuseppe

Hi @GiuseppeDe

$.requestedItemsStatus[?(@.name =~ /.Outlook - Mail box [DIS]/ && @.operation == “Add” && @.approvalInfo.[0].approvalDecision==“APPROVED”)]

The regular expression needs to be changed,

Regular expression you should use: .*Outlook\s\-\sMail\sbox\s\[DIS\]

Reason:
Escaping of space is required along with the escaping of any other special characters.

Try this website for validating the regular expression: regex101.com
Final JSON Path Expression:

$.requestedItemsStatus[?(@.name =~ /.*Outlook\s\-\sMail\sbox\s\[DIS\]/ && @.operation == "Add" && @.approvalInfo.[0].approvalDecision=="APPROVED")]

Hope this helps :slight_smile:

@GiuseppeDe try to validate your json filter looks like its not picking the values correctly

Hello Neeraj,

Yes the problem was the metacharactes, I forgot to escape the regex metacharacters in my filter, now it works.

Thank you very much.
Giuseppe

1 Like

Hello Shantanu,

I forgot to escape the metacharacters in my filter, now it works.

Regards,
Giuseppe

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