Make fields editable in SP widget

Santhana Rajhan
Mega Sage

I got one field from the table "Employee Change Date" , which should be editable in the portal.

Else is there a way to create a widget only for one editable field? That could be much easier

find_real_file.png

 

<div ng-if="data.canRead" class="panel b">
  <div class="panel-heading bg-primary">
    <div ng-init="spSearch.targetRequests()">
      <sp-c-link target="form" table="data.table" id="data.sys_id"/>
    </div>
    <h2 class="sr-only">${Ticket details}</h2>
    <span ng-if="data.agent" >
      ${Agent working on this {{data.tableLabel}}}:
      <div>{{data.agent}}</div>
    </span>
    <span ng-if="!data.agent && data.agentPossible" >${Employee Last Working Date}</span>
    <span ng-if="!data.agentPossible">${{{data.tableLabel}} record details}</span>
   
  </div>

  <div class="panel-body">
    <dl class="ticket-fields" ng-if="data.fields.length > 0">
     
           <dt class= "col-md-6 col-sm-12 col-xs-6 break-word" 
            ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)" 
            ng-repeat-start="field in data.fields">{{field.label}}</dt>
      
        <dd class= "col-md-6 col-sm-12 col-xs-6 break-word" 
            ng-repeat-end ng-switch="field.type" 
            ng-if="field.value && (field.type != 'decimal' || field.type == 'decimal' && field.value != 0)">
          <div ng-switch-when="glide_date_time" title="{{field.display_value}}">
            <sn-time-ago timestamp="::field.value" />
          </div>
          <div ng-switch-default >{{field.display_value}}</div>
        </dd>
      
    </dl>
         


  </div>

  <div ng-if="data.agentPossible && !data.agent && options.pickup_msg" class="panel-footer">
    <div id="ticket_fields_footer" class="text-center text-muted" style="font-style: italic;" ng-bind-html="data.pickupMsg">
    </div>
  </div>

</div>
2 REPLIES 2

Amit18
Giga Contributor

how you sorted out this issue? did you find any solution?

Below is th example of creating an editable field in widget

 

HTML :

<sp-editable-field editable-by-user="true" table="incident" table-id="data.incidentSysID" field-model="data.incidentModel.short_description" on-change="titleOnChange" on-submit="titleOnSubmit"></sp-editable-field>

Server Side:

data.incidentSysID = '361baa10db2f3200474ff1351d96196a'; 

var incidentGR = new GlideRecord("incident");

data.incidentExists = incidentGR.get(data.incidentSysID);

if (data.incidentExists) {

  var incidentForm = $sp.getForm("incident", data.incidentSysID);

  data.incidentModel = incidentForm._fields;

}

Client Controller :

function ($scope, spUtil) {

  spUtil.recordWatch($scope, "incident", "sys_id=" + $scope.data.incidentSysID);

}

 

you should modify your widget slightly to include an editable field

 

-Satheesh