
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 05:30 PM
Hey friends!
I have a workflow that creates tasks for multiple teams who only have visibility to their own tasks (both via ACLs and Before Query Business Rules). Is there a way to have the workflow run entirely as the admin user so that it doesn't matter who can see which tasks? I have a timer at the beginning that usually has the workflow do just.
In this particular workflow, I am trying to use the out of box branch and join activities with all of the associated tasks in between. When someone on one team closes their task the rest of the tasks have their activity results set to "deleted" and the workflow finishes out with all other tasks sitting open. I'm told this is due to our before query business rules but we can't remove them at the moment due to the experience users receive with the "records removed due to security constraints" message.
Any suggestions on how to get the workflow to run as admin? Or am I stuck putting scratchpad variables back into my workflow and counting when all of the tasks are done.
Thanks!
Solved! Go to Solution.
- Labels:
-
Workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2020 02:29 PM
Hi,
Unfortunately thats not possible.
Have you tried using Wait for condition with script instead of Branch and Join?
I mean remove branch and join, create tasks (and dont wait for the closure) followed by a Wait for condition having script which checks if all underlying tasks are closed or not. I remember I had to add a business rule to force the update from child table i.e. sc_task table to RITM so that the Wait for condition is evaluated again. But ServiceNow added "SNC - Run parent workflows" few release ago to do the same OOTB.
In the Wait for condtion script you can use setWorkFlow(false) while doing a query which will override the BR. ACLs does not stop you from querying.
Check if this helps-
https://community.servicenow.com/community?id=community_question&sys_id=845d03e9db9cdbc01dcaf3231f96...
-Tanaji
Please mark responses helpful/correct based on the impact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 01:58 PM
Thanks everyone! I wasn't able to get the gs.getSession().isInteractive() to work with the before query business rule for some reason (could just be me missing a step somewhere) but I definitely may use that method for other things in the future!
I ended up doing a variation of what Tanaji suggested with the wait condition. I had something similar before where it was waiting on a count of scratchpad variables but switched to just checking the count of open child tasks as they get closed. I added in an impersonation and un-impersonation step around the query so it could check for the tasks as an admin user which did the trick.
Just a note, the out of box "SNC - Run parent workflows" business rule is great for triggering the wait for condition activity but if you have a custom table / custom closed states not included in the TaskUtils Script Include like I did, you may need a custom BR for that table or to capture those state changes.
Cheers!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 03:16 PM
Glad you got it resolved.
If you don't mind, if you post another question in the future, please try to offer as much detail as you can regarding things like: custom table and custom closed states...as this can change the solutions provided by the community.
Overall though, glad you figured it out.
Take care!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!