Custom widget for accept or reject buttons for HR case on service portal

SiddeswaraJ
Tera Contributor

Hi everyone,
i was able to figure out how to build a custom Service Portal widget that allows end users to accept or reject the resolution for a HR case

When an HR Case is moved to the Awaiting Acceptance state, the widget appears to the user.
They can either:

  • Accept the solution, which automatically closes the HR Case, or

  • Reject the solution, by providing a reason — Then the case moves to work in progress

but the solution is not working as expected.

I need the scripts(HTML, CSS, Server, Client controller) for any active solution is available for this.

HTML- Script

-----------------

<div class="panel panel-default" ng-if="data.showWidget">
 <div class="panel-heading">Actions</div>
 <div class="panel-body">
   <button type="button" class="btn btn-success btn-block" ng-click="c.openModalClose()" ng-if="data.showclose">Accept Resolution</button>
   <button type="button" class="btn btn-danger btn-block" ng-click="c.openModalReopen()" ng-if="data.showreopen">Reject Resolution</button>
   <button type="button" class="btn btn-danger btn-block" ng-click="c.openModalCancel()" ng-if="data.showcancel">Cancel Ticket</button>
   <div ng-if="data.response1" class="alert alert-info"></div>
 </div>
</div>
<script type="text/ng-template" id="modalTemplateReopen">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Provide a reason for the rejection</h4>
  </div>
      <div class="panel-body wrapper-xl">
      <form name="modalTemplateReopen" ng-submit="c.uiAction('reject')">
        <div class="form-group">
          <textarea required sp-autosize="true" ng-required="true" ng-model="data.rejectionComments" id="rejectionComments" placeholder="Comments required" class="form-control ng-pristine ng-valid ng-scope ng-empty ng-touched" aria-invalid="false" style="overflow: hidden; word-wrap: break-word; resize: horizontal;"></textarea>
        </div>
        <input class="btn btn-primary" type="submit" />
      </form>
    </div>
  </div>
</script>
<script type="text/ng-template" id="modalTemplateClose">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Provide a close notes</h4>
  </div>
      <div class="panel-body wrapper-xl">
      <form name="modalTemplateClose" ng-submit="c.uiAction('close')">
        <div class="form-group">
          <textarea required sp-autosize="true" ng-required="true" ng-model="data.closeComments" id="closeComments" placeholder="Comments required" class="form-control ng-pristine ng-valid ng-scope ng-empty ng-touched" aria-invalid="false" style="overflow: hidden; word-wrap: break-word; resize: horizontal;"></textarea>
        </div>
        <input class="btn btn-primary" type="submit" />
      </form>
    </div>
  </div>
</script>
<script type="text/ng-template" id="modalTemplateCancel">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Provide a reason for the cancelling the incident</h4>
  </div>
      <div class="panel-body wrapper-xl">
      <form name="modalTemplateCancel" ng-submit="c.uiAction('cancel')">
        <div class="form-group">
          <textarea required sp-autosize="true" ng-required="true" ng-model="data.cancelComments" id="cancelComments" placeholder="Comments required" class="form-control ng-pristine ng-valid ng-scope ng-empty ng-touched" aria-invalid="false" style="overflow: hidden; word-wrap: break-word; resize: horizontal;"></textarea>
        </div>
        <input class="btn btn-primary" type="submit" />
      </form>
    </div>
  </div>
</script>
waiting for Response,
Thank You.
3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@SiddeswaraJ 

where to add this custom widget?

check this link and enhance for HR Case for Accept/Reject

ReOpen Incident Option on Service portal for end users. 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I need to add this widget to the ticket page, it should be visible on service portal , it is fine if you have a common solution for HR case and incidents, that means a common accept or reject widget

@SiddeswaraJ 

the link I shared has approach for Standard Ticket page only.

HR Case and Incidents are different in nature.

it's better to keep them separate as Incidents once resolved can be re-opened via inbound email action by the caller.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader