Service portal Cancel Button change approval state to Cancelled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 08:46 AM - edited 05-14-2025 05:24 PM
Hello,
I am tasked with creating a Cancel button on the service portal for my custom table.
I have the button but I am having a hard time getting the button to change the approval state to "Cancelled"
Please advise:
HTML:
<h4 class="panel-title" ng-if="c.data.state == 'cancelled'">${Request has been cancelled} <sn-time-ago timestamp="::c.data.sys_updated_on" /></h4>
<div>
<button class="btn btn-danger" ng-click="c.openModalcancel()">Cancel Request</button>
<!-- Cancellation Modal Template -->
<script type="text/ng-template" id="modalTemplateCancel">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<label> Justification for Cancelling Request </label>
<textarea class="form-control" rows="4" ng-model="c.data.comments" required></textarea>
</div>
<div class="form-group">
<button ng-disabled="c.data.comments == ''" class="btn btn-primary btn-lg" ng-click="c.action('cancelled');c.closeModal();">${Submit}</button>
</div>
<div class="panel-footer text-right">
<button class="btn btn-primary" ng-click="c.closeModal()">Cancel</button>
</div>
</div>
</div>
</script>
Client Script:
Server Script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 09:43 AM
you want this to be shown on form widget in portal?
If yes then you can refer this
Need to modify Cancel Button on Service Portal and make it to work on RITM Stage Field
Confirmation box on click of Cancel button in Service Portal
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 07:01 AM
The widget button is showing as it should. My request was for the state field to be put into "Cancelled" status