- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2017 01:42 PM
Currently our Change process requires all application Change Requests to start off as a RITM. As part of the workflow for the RITM, there is an 'Approval - Group' Activity that will send an approval request to the Business Approval Group that owns the application. If someone in the Business Approval group approves the RITM, then a Change Request will automatically get created and assigned to the proper App Dev Team.
If the person who submits the request is in the Business Approval Group, the request is considered Automatically approved. This is done via a Business Rule that runs on Insert of the Approval Table (please see the script at the end of this post).
The problem is that the workflow has already sent the approval requests to everyone in the Approval Group. Therefore, people are getting approval e-mails for things that are automatically approved.
Any idea how to not send any e-mail to people when something is automatically approved (but still have that approval records showing that it was approved by the business unit - since the submitter was in the business unit)?
Any help would be greatly appreciated.
Thanks!
skipSupervisorApproval();
function skipSupervisorApproval(){
var sys_user_table = new GlideRecord('sys_user');
var creater_sys_id;
sys_user_table.addQuery('user_name', current.sys_created_by);
sys_user_table.query();
while(sys_user_table.next()) {
creater_sys_id = sys_user_table.sys_id;
if(creater_sys_id == current.approver){
//set the state to approved and add comments
current.state = 'approved';
current.comments = "Marked by system as 'Approved' because I requested the approval and I am also in the approver group.";
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2017 12:15 PM
Hi Harel. Sorry for the delay in responding. I was afraid to stop the workflow, so instead I just wrote a script to prevent the e-mails from being sent (please see script below which I wrote). This seems to be working for me.
Thanks again for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2017 08:17 AM
Hi James,
You can add an advanced condition in the approval email sent. Something like:
if((current.sysapproval.sys_class_name == "sc_req_item") && (current.sysapproval.request.requested_for.isMemberOf('SOME GROUP'))) {
answer = false;
}
This should not send the mail if the user is in that group.
Try it out and let me know if OK.
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 07:05 AM
Thank you very much Harel. Unfortunately, I don't think it will be that simple. Here is the issue:
The workflow requires two levels of approval.
- From the Business Owner of the Application that is being changed. This changes depending on which application is being selected in the RITM (each application has a different Business owner in the CMDB).
- From the Technical Approval Group of that application. Again this changes on what application is being selected - this is also in the CMDB.
Once the Business Approves the Change Request, it goes to the Technical Approval Group to Approve. Therefore, I am not sue how to get the correct 'SOME GROUP' that you noted in your above script. In other words, how would you recommend I determine if the approval is for the Business Owning group or the Technical Approval Group? I hope that makes sense. Please let me know what you think and thanks again for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 08:59 AM
Hi James,
So how about adding to your script the following line:
current.setWorkflow(false); //don't trigger BR or any notifications
This would go above the current.state = 'approved'; line
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2017 12:15 PM