I have a requirement where a change request goes through 4 level of approvals , first…
- User
I have a requirement where a change request goes through 4 level of approvals , first from the ag approval , second from Configuration item AG approval third from the Change Request.AG approval and fourth one from Change Request Approval.AG approval .
so if the requested by or assigned to is a member of any of the above mentioned 4 AG approval group it should show the state as "not required" for those members in all the 4 AG approval levels
the first two approval groups first from the ag approval , second from Configuration item AG approval is managed by this part of code : (current.sysapproval.requested_by.sys_id == current.approver.sys_id || current.sysapproval.assigned_to.sys_id == current.approver.sys_id and it is working perfectly fine
How to manage the scenario where the requested by or assigned to is a member of the Change Request.AG or Change Request Approval.AG -- this code is not working
How can I fix the above mentioned highlighted issue .
Business rule :
The BR is writted on the sysapproval_approver table and its an after insert BR . Script : var usr= current.approver.sys_id; var mbr =[]; var mbr2 =[]; var grp = new GlideRecord('sys_user_grmember'); grp.addQuery('group', '67598c756f6a6100800e9eff6f3ee4e5');//Change Request.AG grp.addQuery('user', usr); grp.query(); while(grp.next()){ mbr.push('yes'); }
var grp2 = new GlideRecord('sys_user_grmember'); grp2.addQuery('group', 'f37d1d6adb57e050d407da75ca9619e7');//Change Request Approval.AG grp2.addQuery('user', usr); grp2.query(); while(grp2.next()){ mbr2.push('yes'); } if(current.sysapproval.requested_by.sys_id == current.approver.sys_id || current.sysapproval.assigned_to.sys_id == current.approver.sys_id && mbr =='' && mbr2 ==''){ current.state = 'not_required'; current. Update(); }
- Assistant
The condition in your
ifstatement checks for membership in the 'Change Request.AG' and 'Change Request Approval.AG' using the arraysmbrandmbr2. However, the way you're checking these arrays is flawed. You're using and to determine if they're empty, but since they are arrays, this comparison will not work as intended. In JavaScript, comparing an array directly to an empty string will not check its emptiness correctly. - User
I have daily export from ServiceNow instance using export set to MidServer folder. My use case is to export this file from the MidServer to another third party SFTP site. Any help is highly appreciated?
- Assistant
- User
I'm trying to report on impacted services and some of our changes are showing multiple services per change. What is the best way to report on this without showing duplicate changes. Is it possible? During cab we were hoping to present the data by service..just now sure what is the best approach.
- Assistant