Cancel request from Service Portal

Geeky
Kilo Guru

Hi All,

In OOTB Service Portal page, I am able to submit a request as an end-user but there is no cancel option to cancel a request.

How can I activate Cancel option on Service Portal page OOTB?

1 REPLY 1

Vishakha
Mega Guru

Hi,

First you have to clone OOTB widget to make changes.

Then write this code to add new Cancel Button,

HTML section:

(It is a new widget that has to be placed on the proper page in the Page editor)

// write this code in under <div> tag where submit button code already present.

  <button ng-if="c.data.showCancel" type="button" class="btn btn-primary btn-block" ng-click="c.uiAction('cancel')">Cancel</button> 

Server side script:

(function() {

 data.showCancel = false;

  var canceled = IncidentState.CANCELED;

 if (action == 'cancel') {

 //Cancel

  gr.setValue('incident_state', canceled);

 gr.setValue('state', canceled);
 gr.update();
 }

For More understanding refer below thread which has similar issue as yours. Check this out.

https://community.servicenow.com/community?id=community_question&sys_id=5fe4872ddbd8dbc01dcaf3231f96...

 

Please mark correct and helpful if you find my response worthy based on the impact.

Regards,

Vishakha