sn-record-picker public

jackinsidend
Giga Guru

Is it possible to expose a custom or out of box table (read only) in a widget to unauthenticated users?

I have my widget public, page public, and public role on table but it only works when logged in. It just shows searching when not authenticated.

Any idea?

<sn-record-picker field="location2" table="'cmn_location'" display-field="'name'" default-query="'GOTOu_hierarchy_typeLIKEBuilding^u_hierarchy_type=Building^parent=54ece5a74f5dfa4070dee3414210c738'"

              value-field="'sys_id'" search-fields="'name'" page-size="100" >

Thanks,

Jack

8 REPLIES 8

Bob
Giga Contributor

Same issue, did you ever find a solution? I have tried modifying the ACL's to the table I am reading records from. In my case the sys_choice list, but giving read access did nothing. Anyone got an angle on this?



find_real_file.png


Bob
Giga Contributor

nathanfirth



Any love?


This is what I have working, make locations public and widget public too.



HTML template:



<div id="name-group" class="form-group" ng-class="{'has-error' : SafetyForm.location.$invalid && !SafetyForm.location.$pristine}">


              <label>Location*</label>


                            <ui-select ng-model="c.selected.value" on-select="c.onSelectCallback($item, $model)" ng-required="true">


                      <ui-select-match>


                              <span ng-bind="$select.selected.name"></span>


                      </ui-select-match>


                      <ui-select-choices repeat="item in (c.locations | filter: $select.search) track by item.sys_id" refresh="c.refreshLocation($select.search)"


                              refresh-delay="0">


                              <span ng-bind="item.name"></span>


                      </ui-select-choices>


              </ui-select>


              <span class="help-block" ng-show="SafetyForm.location.$invalid && !SafetyForm.location.$pristine">


                      Please describe the location.


              </span>


      </div>



**************



Server :



(function() {


var locations = [];


if(input && input.action === 'searchLocation'){


var grl = new GlideRecord('cmn_location');


if(options.locations_query){


grl.addEncodedQuery(options.locations_query);


}


grl.addQuery('name', 'CONTAINS', input.query);


grl.setLimit(20);


grl.query();


while(grl.next()){


locations.push({


name: grl.name.toString(),


sys_id: grl.sys_id.toString()


});


}


data.locations = locations;


return data;


}



*****



Client



c.locations = [];




  c.data.location = '';


c.selected = {value: c.locations[0]};



c.refreshLocation = function(query){


if(query) {


c.server.get({


action: 'searchLocation',


query: query


}).then(function(response){


c.locations = response.data.locations;


});


}



}


c.onSelectCallback = function(item, model) {


c.data.location = item.sys_id;


}


c.remove = function (item) {


var index = c.data.files.indexOf(item);


c.data.files.splice(index, 1);


}



}


Bob
Giga Contributor

So I also had a high ticket in for this and ServiceNow came up with almost the same answer.



Theirs was two part:


  1. Make the page <whatever the table is you are trying to use the record picker against> publicfind_real_file.png
  2. Because I had multiple widgets using the sn-record-picker, put a security rule to allow the role "public" accessfind_real_file.png


Honestly Jack, I appreciate you coming back and replying. You should mark your own answer correct so that others can find it easier.



Thanks Much!