- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 10:46 AM
Hello:
I have the onChange catalog client script below, on a Record Producer (Catalog Item). It works when I am logged in as an Itil user - the alert displays the correct sys_id.
However, I'd like it to work for anonymous users, but when not logged in the alert does not execute
The work_unit field on the Record Producer is public, the ACLs on the Work Unit table allow read access, and as an anonymous user I can display the work units from the portal.
I think the callback function may be restricted somehow, but not sure what else to try and would appreciate any help. Thank you.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 10:58 AM
You are indeed correct; getReference runs under the credentials of the logged in user and for unauthenticated users will not return expected results in most cases.
You would need to convert this to using GlideAjax to make the call and return the values.
You would also need to make the privacy of your script include public for a non-logged in user to be able to execute it.
I hope this helps!
If this was helpful, or correct, please be kind and mark the answer appropriately.
Michael Jones - Proud member of the GlideFast Consulting Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 10:58 AM
You are indeed correct; getReference runs under the credentials of the logged in user and for unauthenticated users will not return expected results in most cases.
You would need to convert this to using GlideAjax to make the call and return the values.
You would also need to make the privacy of your script include public for a non-logged in user to be able to execute it.
I hope this helps!
If this was helpful, or correct, please be kind and mark the answer appropriately.
Michael Jones - Proud member of the GlideFast Consulting Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 02:09 PM
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 08:05 AM
Hello:
I thought I'd submitted a follow up here yesterday, but do not see it so am replying again (sorry if I'm creating a duplicate reply).
What I am trying to do it populate a reference field on the Service Catalog (using a Record Producer) based on the value of another reference field. Thanks to the replies here, I was able to use GlideAjax in a Client Catalog script and Script Include to return the sys_id of the field I would like to populate on the Service Catalog form (see below). When I am logged in, setting the value of the reference field to the returned sys_id does populate the field, but this does not work when I am not logged in. Is there a way to have the field populated for anonymous users?
I am guessing that the Script Include (or other server side script) must populate the reference field, I'm not sure if this is correct, or if there is any other way to accomplish my goal. Thank you again for any help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2022 09:00 AM
So as an Anonymous User, you can see values in the first reference field (I guess obviously) to make a selection, but do you see any options in the second reference field (the one you are trying to populate)? If you can't manually select a value as that user, that would mean the records on that table are not accessible to a non-logged in user, which would be most tables.
Can I ask what your specific use-case is for this second field?
Since this is a record producer, do you need to display a value to the user (a display value) and then set a reference field on the target record? You might be able to do this by using two text fields - one would be visible to the user and you would populate it with your ajax call and show the displayValue of the record. The second would be hidden and you would populate it with same ajax call with the sys_id of the record. Then, in your Producer Script you would set the value of the reference field as the record is being created with something like:
current.<reference_field> = producer.<variable_with_sys_id>
Otherwise, if you really need them to see it as a reference field, you will need to explore if they have access to the records on that table and, if not, work out the necessary ACL's to give them Read those records and the display value (add the Public role - use the other table as an example). Tread carefully here however; you don't want to give public access to any sensitive data and you don't want to violate any licensing you might have, bypassing required roles for access - I mention this as I've no idea what tables you're using here.
I hope this helps!
If this was helpful, or correct, please be kind and mark the answer appropriately.
Michael Jones - Proud member of the GlideFast Consulting Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!