How To bypass the Before Business Rule and make the Flow Designer run to cancel the change

Sruthi_2511
Tera Contributor

I have created one "Before "Business Rule-

var AssignmentGroupM = false;
    var currentUser = gs.getUser();
    AssignmentGroupM = currentUser.isMemberOf(­current.assignment_group.getDisplayValue());
    if (!AssignmentGroupM) {
        gs.addErrorMessage('Change Can't be  cancel. ');
        current.setAbortAction(true);
    } else {
        current.work_notes = 'Change cancelled.';
    }  which is required as per requirement. 
 
The thing is I have to cancel the Change request by a "Flow Designer" which is preventing by this Business. I  want the Business Rule to be active as well. How I can bypass the Business Rule and cancel the change request. Is there any workaround or any suggestion?
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Sruthi_2511 

add this in the condition of the BR

gs.getSession().isInteractive()

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

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

View solution in original post

10 REPLIES 10

Thanks