The CreatorCon Call for Content is officially open! Get started here.

SP Widget ACL Issue & Ordering Issue

EthanVanDoorne
Giga Contributor

I am having some issues displaying some simple incident data using an SP widget with spUtil.recordWatch. The issue is that everything is good for roled users, however users without a role cannot view the data. I was under the assumption that if I was grabbing records with a GlideRecord query that there shouldn't be a problem...

My second issue here is that I'm not able to get the records to sort by number descending. Shown below are a few methods I've tried and none of them work. Need the appropriate config for ordering of these records as well.

Any help would be massively appreciated!

My widget is as follows:

Server Script:

(function() {

  /* populate the 'data' object */

  /* e.g., data.table = $sp.getValue('table'); */

  data.incidents = [];

// Grab resolved P1s

  var gr = new GlideRecord('incident');

gr.addQuery('opened_atRELATIVEGE@dayofweek@ago@14^priority=1^incident_stateIN1,2,8,12,3,4,5,10,11');

      gr.setLimit(20);

      gr.orderByDesc(options.order_by);

      gr.query();

      while(gr.next()) {

              var incident = {};

              incident.number = gr.getDisplayValue('number');

              incident.short_description = gr.getDisplayValue('short_description');

              incident.sys_id = gr.getUniqueValue();

incident.incident_state = gr.getDisplayValue('incident_state');

              incident.opened_at = gr.getValue('opened_at');

incident.resolved_at = gr.getValue('resolved_at');

              data.incidents.push(incident);

      }

})();

Client Controller:

function($scope, spUtil) {

  /* widget controller */

  var c = this;

  $scope.orderField = "number";

  $scope.changeSort = function(field) {

  $scope.orderField = field;

};

  // this makes the UI watch the data tables and update on changes

  spUtil.recordWatch($scope, "incident", "", function(name, data) {

            spUtil.update($scope);

});

}

1 REPLY 1

larstange
Mega Sage

Hi



I can give you an answer on the first issue. The OOTB business rule "incident query" is preventing non roled users from quering incidents that they are not the caller on. This works in any gliderecord query made against the incident table and is not an ACL issue.