Standard Ticket Action Widget in Custom Application

Kev9
Kilo Sage

Hi,

 

We're looking to utilise the Standard Ticket Actions widget on our custom application to replicate the ability in OOTB Incident Management to re-open cases.

 

I've cloned the widget and amended references to tables etc to the custom application and created associated sript includes.

 

I've then added the widget in the standard ticket application > Ticket Configuration > Action Region > Action Widget but the widget does not appear on the page.

Has anyone any experience of doing this?

 

Many thanks.

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="caret"></span>
        </button>
        <ul class="dropdown-menu pull-right" id="actionList">
           
            <li>
                <a ng-if="data.canReopen" href="javascript:void(0)" ng-click="$event.stopPropagation();reopenCase()">${Reopen}</a>
            </li>
            
        </ul>
    </div>
  
</div>

 

Server Script

(function() {
    var caseGr = new GlideRecord('x_our_table');
	var caseSysId = options.sys_id;
	
	if (!caseSysId && $sp.getParameter('table') == 'x_our_table')
		caseSysId = $sp.getParameter('sys_id');
	
	
	
	/* Actions - Start */
    
	if (input && input.action == 'reopenIncident' && caseGr.get(caseSysId)) {
        caseGr.state = UosCmtStateUtil.IN_PROGRESS;
		data.isCaseReopened = caseGr.update();
		gs.addInfoMessage(gs.getMessage("Case reopened"));
    }
	
	
   /* Actions - End */
	
	/* Load incident data */
    if (caseGr.get(caseSysId)) {
		var UosCmtUtils2 = new x_our_table.UosCmtUtils2();
		data.canReopen = UosCmtUtils2.canReopenCase(caseGr);
		
		data.showActions = data.canReopen;
    }

    data.i18n = {};

})();

 

Client Controller

function caseTicketActions($scope, $http, spUtil, $timeout, spModal, i18n, $window, $uibModal, spAriaUtil) {
    /* widget controller */
    var c = this;
    c.doneLoading = false;
    c.reopenedCaseMsg = "${Reopened Case}";

    var MOBILE_DEVICE_SCREEN_WIDTH = 767;
    $scope.mobileDevice = c.data.isMobile || ($window.innerWidth < MOBILE_DEVICE_SCREEN_WIDTH);

	

    $scope.reopenCase = function() {
        $scope.data.action = 'reopenCase';
        $scope.server.update(init).then(function(response){
					if (response.isCaseReopened)
						spAriaUtil.sendLiveMessage(c.reopenedCaseMsg);
				});
			$scope.$emit('focusOnActions', {"isFocusRequired": true});
    };

    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;
        }
    });
}
3 REPLIES 3

Ammar Gabr
Tera Contributor

How did you solve this issue?

Community Alums
Not applicable

Hi Ammar 

Did you find any solution for this?

Kev9
Kilo Sage

Hi Ammar,

TBH being 12 months ago I can't really remember! Looking at the scripts above and the widget currently I think it was an error in the Script Include that fixed it.

Regards,

 

Kevin