PrashantLearnIT
Giga Sage

Hello Everyone,

 

Approval activity is being skipped due to the approvals not being in the same domain as the user submitting in the request.

Approval activity is being skipped while using domain separation plugin

Approval Workflow Skipping Approval Step due to Approval Group's User's domain

Expected behavior: The request should be pending approval from the approval group but request bypassed the group approval, this, in turn, approved/cancels the request 

Solution:

Navigate to Script include : ""WorkflowApprovalUtils" 

Locate the "getMembersOfGroup" method and replace query with queryNoDomain 

getMembersOfGroup: function(groupID) {

      var ids = [];

      if (!groupID)

         return ids;

     

      var gr = new GlideRecord('sys_user_grmember');

      gr.addQuery('group', groupID);

      gr.addNotNullQuery('user');

      gr.addQuery('user.active', true);

      gr.query();

      while (gr.next()) {

         ids.push(gr.getValue('user'));

      }

     

      return ids;

   },

 

If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL

 

Best Regards,

Prashant Kumar (LearnIT)

 

YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant

Blog LearnIT: https://medium.com/@LearnITbyPrashant

Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/

ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635