setJournalEntry(input.cancelComments) to get comments from text area

Elton2
Tera Contributor

Hi everyone, 

 

I'm trying to use the setJournalEntry() method, passing it as a parameter the input.cancelComments object, but it's not working.

u_justificativa_cancelamento is where I need to get the comment typed by the user (attached image)

 

Example: When the user wants to cancel a RITM, it is necessary leave a comment, and that's the comment I need to catch, because it's not bringing anything.

 

My code:

 

 HTML:
<div class="panel panel-default">
<div class="panel-heading" style="display:flex;gap:8px;">
  <h4 class="panel-title">Justify the reason for the cancellation request:</h4><span style="color: #ED1D24;">*</span>
</div>
<div class="panel-body wrapper-lg">
  <form name="modalTemplateCancel" ng-submit="cancelIncident()">
    <div class="form-group">
      <textarea required sp-autosize="true" ng-required="true" ng-model="data.cancelComments" id="cancelComments"
        placeholder="" 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;max-width:100%;">
      </textarea>
    </div>
    <input class="btn btn-primary" type="submit" ng-disabled="!data.cancelComments" value="${Submit}"/>
  </form>
</div>
</div>

  CLIENT SCRIPT:
  $scope.$on('record.updated', function(name, data) {
    c.data.cancelComments = '';
   
    $scope.data.action = '';
   
    spUtil.update($scope);
  });

  SERVER SCRIPT:
  if (input && input.action == 'cancelReq' && reqItemGr.get(reqItemSysId) && input.cancelComments != '') {
      reqItemGr.state.setValue(RequestStates.canceled);
      reqItemGr.u_justificativa_cancelamento.setJournalEntry(input.cancelComments)
      data.isReqCanceled = reqItemGr.update();
  }
 
Could anybody help me? Please!
0 REPLIES 0