top of page

How to disable the CAB Workbench's confirmation pop-window

We've all had that one customer whose metric for optimization is clicks and burn rate, and while ServiceNow does a great job at helping streamline many business tasks. One question that gets asked quite a bit on the community forum is to remove the confirmation popup-window. Let’s take a look at how we can save a few clicks on the CAB.


 

Before we begin its best practice to make copies of all things out of the box in ServiceNow. For this demonstation we will simply be editing things directly. If you were to do this be sure to make a copy for your custom workbench.


Now, if you go look at your widgets (sp_widget) you will see one named CAB Workbench - Current


Agenda Item (cab-current-agenda-item)

In the client script you can scroll down to the approval CTRL we see a chain of .then statments with a popModal passing data down to an approval.approve API call. CAB Workbench (Internal API) on the (sys_ws_operation) table if you want to see all the stuff you can intenraly call. 



So first let’s comment out the popup and then remove the "approvalDataObj" that’s passed into the next function. Afterwards modify approval.approve so it takes what’s currently in the @$scope. Before, the popup modal would modify the scope values with what was inputted in the pop up. We can still get the current users approval group, but we will have to hard code the comment.


A modification I've made is instead of waiting for the returned promise on the approval.approve i.e waiting for the record to report back that its modified. We can just send that API call as is, and have a quick function to return something to continue our .then chain.


I've also copied the next functions .then, so when you click approval it instantly approves it and moves to the next item in the CAB.


 .then(function() { // Adding the next fucntionality to Approve
 	return meetingAgenda.getNextPendingAgendaItem();
 })
 .then(function(agendaItem) {
 	return runtimeState.noDecisionNextAgendaItem(agendaItem.sys_id.value);
 })

Here is what the final product should look like:


Here is the code if you want to copy and paste instead of typing it out:

"approve": {
			"hasFocus": false,
			"focus": function() {
				toggleFocus(approvalCtrl.approve);
			},
			"onClick": function() {
				reauthenticateForApproval()
// 				.then(function() {
//					return popModal("cab-approve-pop");
// 				})
				.then(function() {
					$scope.lastApproval = {
						requiredUserApproval: true,
						approved: true
					};
					approvalCtrl.enabled = false;	
									
					approval.approve($scope.item.task.value, '[code]<p>APPROVED</p>[/code]', $scope.approval.groups[0].sys_id);
// 				return approval.approve($scope.item.task.value, approvalDataObj.comment, approvalDataObj.approvalGroupSysID);
 					return {then:function(f){
 						return f();
 					}}								
				})
 				.then(function() { // Adding the next fucntionality to Approve
 					return meetingAgenda.getNextPendingAgendaItem();
 				})
 				.then(function(agendaItem) {
 					return runtimeState.noDecisionNextAgendaItem(agendaItem.sys_id.value);
 				})
				.then(
					function() {
						approvalCtrl.enable();
						agendaCtrl.current.focus();
					},
					function() {
						approvalCtrl.enable();
						approvalCtrl.approve.focus();
					}
				);
			}
		},

Keep a lookout for our posts on the community forum and more blog posts to come!

31 views0 comments

Recent Posts

See All

Comments


bottom of page