Action on widget - portal Record
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 12:18 AM
Hello, im trying to add the Action button on portal - record.
as yo can see on the incident record
I have new table that I also want this feature to be in it.
I created new "standard ticket configuration"
and cloned the "incident Standard Ticket Actions"
I'm having troubles with configuration the record
I will share the HTML , SERVER SIDE , CLIENT SIDE
HTML
<div>
<div class="dropdown" id="child-case-tabs" ng-if="data.showActions">
<button type="button" id="actions-button" class="btn btn-default dropdown-toggle action-btn" data-toggle="dropdown" style="width : 100%" aria-haspopup="true" ng-init="setFocusOnActionButtons()">
${Actions}
<span class="fa fa-caret-down"></span>
</button>
<ul class="dropdown-menu pull-right" id="actionList">
<li ng-if="data.canClose">
<a href="javascript:void(0)" ng-click="$event.stopPropagation();closeIncident()">${Close}</a>
</li>
</ul>
</div>
</div>
SERVER SIDE
(function() {
var incidentGr = new GlideRecord('u_department_of_finance');
var incidentSysId = options.sys_id;
gs.info('eyal test portal');
if (!incidentSysId && $sp.getParameter('table') == 'u_department_of_finance')
incidentSysId = $sp.getParameter('sys_id');
// if (!incidentSysId && $sp.getParameter('table') == 'universal_request') {
// var urGr = new GlideRecord('universal_request');
// urGr.get($sp.getParameter('sys_id'));
// incidentSysId = urGr.primary_task + "";
// }
/* Actions - Start */
if (input && input.action == 'closeIncident' && incidentGr.get(incidentSysId) && hasPermissions(incidentGr, "write")) {
// incidentGr.incident_state = global.IncidentState.CLOSED;
incidentGr.state = global.IncidentState.CLOSED;
data.isIncidentClosed = incidentGr.update();
}
/* Actions - End */
/* Load incident data */
if (incidentGr.get(incidentSysId) && hasPermissions(incidentGr, "read")) {
gs.info('eyal test portal');
var incidentUtils = new global.IncidentUtils();
data.canResolve = incidentUtils.canResolveIncident(incidentGr);
data.canReopen = incidentUtils.canReopenIncident(incidentGr);
data.canClose = true;
data.showActions = true;
}
function hasPermissions(gr, operation) {
//if (operation == "read" && gr.canRead())
return true;
// if (operation == "write" && gr.canWrite())
// return true;
// return (gr.getValue("caller_id") == gs.getUserID()) || (gr.getValue("opened_by") == gs.getUserID());
}
data.i18n = {};
})();
client controller
function incidentTicketActions($scope, $http, spUtil, $timeout, spModal, i18n, $window, $uibModal, spAriaUtil) {
/* widget controller */
var c = this;
c.doneLoading = false;
c.closedIncidentMsg = "${Closed Incident}";
var MOBILE_DEVICE_SCREEN_WIDTH = 767;
$scope.mobileDevice = c.data.isMobile || ($window.innerWidth < MOBILE_DEVICE_SCREEN_WIDTH);
$scope.closeIncident = function() {
$scope.data.action = 'closeIncident';
$scope.server.update(init).then(function(response){
if (response.isIncidentClosed)
spAriaUtil.sendLiveMessage(c.closedIncidentMsg);
});
var elm = document.getElementById('short-desc')
elm.focus();
};
function init() {}
$(document).on('click', 'div.modal-footer button.btn, ul#child-case-tabs .dropdown-menu', function(e) {
e.stopPropagation();
});
$(document).bind('dragover drop', function(event) {
event.preventDefault();
return false;
});
$scope.$on('sp_loading_indicator', function(e, value) {
if (!value && !c.doneLoading) {
c.doneLoading = true;
}
});
}
0 REPLIES 0