- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 11:10 AM
Hi SN Experts,
I currently have a widget on the Portal that, when clicked, creates a child incident and associates the parent.
We want to add a pop-up message to this that tells the user they've been added and they must click OK to close the pop-up.
<button type="button" class="btn btn-primary btn-block" ng-click="sysverb_child_new()">Add me to this issue</button>
// Server Script
(function() {
// Get table & sys_id
data.sys_id = input.sys_id || $sp.getParameter("sys_id");
//input
if (input && input.action == 'sysverb_child_new') {
var sr = new GlideRecord('incident');
if (sr.get(data.sys_id)) {
var jr = new GlideRecord('incident');
jr.initialize();
jr.setValue('incident_state', 'Assigned');
jr.setValue('state', 9);
jr.setValue('assigned_to', sr.assigned_to);
jr.setValue('assignment_group', sr.assignment_group);
jr.setValue('short_description', sr.short_description);
jr.setValue('description', sr.description);
jr.setValue('caller_id', gs.getUserID());
jr.setValue('parent_incident', data.sys_id);
jr.setValue('u_on_behalf_of', gs.getUserID());
jr.setValue('u_callback_number', gs.getUser().getRecord().getValue('phone'));
jr.setValue('location', gs.getUser().getRecord().getValue('location'));
jr.setValue('contact_type', 'self-service');
jr.setValue('category', sr.category);
jr.setValue('subcategory', sr.subcategory);
jr.setValue('impact', sr.impact);
jr.setValue('urgency', sr.urgency);
var sysIdTemp = jr.insert();
}
}
})();
I had this as an info message (see below code) but users seem to be missing / overlooking it.
// Client Controller
api.controller = function($scope,spUtil) {
var c = this;
$scope.sysverb_child_new = function() {
var clientObj = {action:'sysverb_child_new'};
c.server.get(clientObj).then(function(response) {
spUtil.addInfoMessage("You've been added to this Incident", 3000);
$sp.getWidget();
c.data = response.data;
})
}
};
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 11:27 AM
Hi @JuliaHowells ,
You can just use "alert" to show "ok" button.
alert("You've been added to this Incident");
You can use below code -
api.controller = function($scope,spUtil) {
var c = this;
$scope.sysverb_child_new = function() {
var clientObj = {action:'sysverb_child_new'};
c.server.get(clientObj).then(function(response) {
alert("You've been added to this Incident"); // This will give you an alert with ok button
$sp.getWidget();
c.data = response.data;
})
}
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 11:27 AM
Hi @JuliaHowells ,
You can just use "alert" to show "ok" button.
alert("You've been added to this Incident");
You can use below code -
api.controller = function($scope,spUtil) {
var c = this;
$scope.sysverb_child_new = function() {
var clientObj = {action:'sysverb_child_new'};
c.server.get(clientObj).then(function(response) {
alert("You've been added to this Incident"); // This will give you an alert with ok button
$sp.getWidget();
c.data = response.data;
})
}
};