Before query business rule to hide records for certain catalog item is impacting Approvals

Siddharth Parna
Tera Contributor

Have created a business rule on Catalog Item and Task to restrict the visibility of catalog items to certain users of the group.Approvals are not being created when users outside the group are submitting the request.Business rule donot have any customizations related to Approvals.

Service Now Image New.PNG

3 REPLIES 3

Nilesh Pol
Tera Guru

Hi @Siddharth Parna 

following script may assist you to achieve your requirement.

var userGroup = 'your_group_sys_id'; 
var requestedFor = current.requested_for;
var isMember = false;

var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', requestedFor);
gr.addQuery('group', userGroup);
gr.query();
if (gr.next()) {
isMember = true;
}

return isMember;

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Siddharth Parna 

your query business rule already has interactive session check so ideally it should not run

Did you try adding log and see if this BR is running and causing this issue?

How are you creating the approvals workflow or flow?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur !

 

The Approvals are being triggered through Flow. I am adding the approvals in Catalog item section.


I tried deactivating the business rule and I see approvals are triggering.

 

is there any way to make the approvals with business rule on. I would need approvals to fire with catalog item visibility restriction in place