- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 07:53 AM
Good morning developers,
I have a service portal question. On the Ticket Conversations Page, I created two buttons that allows users to close their ticket if they accept the resolution or reopen the ticket if they reject the resolution. The buttons work fine but the problem is that I want to refresh the page after the user clicks either one of the buttons. How would I go about accomplishing that? Here's a copy of my code if that will help:
HTML:
<div class="panel panel-default" ng-if="data.showWidget">
<div class="panel-heading">Actions</div>
<div class="panel-body">
<button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction('accept')" ng-if="data.showResolve">Accept Resolution</button>
<button type="button" class="btn btn-default btn-block" ng-click="c.uiAction('reject')" ng-if="data.showResolve">Reject Resolution</button>
</div>
</div>
Client Script:
function($scope,spUtil,$location) {
var c = this;
c.uiAction = function(action) {
if(action == 'reject'){
var r = confirm("Are you sure you want to reject this request?");
if(r == false){
return;
}
}
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
})
}
}
Server Script:
(function() {
// Get table & sys_id
data.table = input.table || $sp.getParameter("table");
data.sys_id = input.sys_id || $sp.getParameter("sys_id");
// Valid GlideRecord
gr = new GlideRecord(data.table);
if (!gr.isValid())
return;
// Valid sys_id
if (!gr.get(data.sys_id))
return;
//Button Visibility
if(data.table == 'u_incident' && gr.incident_state == 3 && gr.priority > 2 || data.table == 'u_request' && gr.incident_state == 3 && gr.priority > 2){
data.showWidget = true;
data.showResolve = true;
}
else {
data.showWidget = false;
data.showResolve = false;
}
if (input && input.action) {
var action = input.action;
// If Incident table
if (data.table == 'u_incident'|| data.table =='u_request') {
if (action == 'accept') {
// Close Incident
gr.setValue('incident_state', 4);
gr.setValue('u_resolved_date', gs.nowDateTime());
gr.setValue('u_agreed_etr', false);
gr.work_notes = "closed by caller";
gr.comments = "User Closed Ticket";
gr.setValue('u_closure_source', "ESS");
gr.update();
gs.addInfoMessage("Ticket " + gr.number + " has been closed!");
}
if (action == 'reject') {
// Reopen Ticket
gr.setValue('true')
gr.setValue('incident_state', 5);
gr.setValue('u_resolved_date', '');
gr.u_reopen_count +=1;
gr.update();
gs.addInfoMessage("Ticket " + gr.number + " has been reopened!");
}
}
}
})();
Thanks in advance,
cnharris
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 08:15 AM
Hi,
Please follow the below link:-
If i was able to solve your query, please mark my answer correct and helpful.
Thanks & Regards
Prasant kumar sahu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 08:15 AM
Hi,
Please follow the below link:-
If i was able to solve your query, please mark my answer correct and helpful.
Thanks & Regards
Prasant kumar sahu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 01:07 PM
Thanks Prasant, that pointed me in the right direction.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2023 09:04 PM
Not sure if this helps anyone else, but the to the original question's point of redirecting. I just added "$window.location.href='myhref'" to the .then() of my c.server.update() call.
Also, for my purpose, I received the href from the server side code so I used that as my href.