- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 10:39 AM
We have a record producer in our Human Resource: Core application. One of the variables is mapped to subject_person. I need to make this read only for non HR staff and non leaders. I thought this would be easy enough with a catalog client script however, I am getting a script error.
Script error: "[SCRIPT:EXEC] Error while running Client Script "Read only subject person": ReferenceError: sn_hr_core is not defined".
Syntax used: g_form.setReadOnly('subject_person', true);
Why would sn_hr_core not be defined?
Does anyone know how to work around this error?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 02:00 PM
You can't call a Script Include from a Client Script like this, you have to use GlideAjax. Here's an excellent guide on how to do that.
Also, add an alert on hrStaff - I'm not sure you can/need to use the application prefix when using hasRole.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 01:56 PM
Hi @abrahams
The script include call in your code is used in server side logic to call SI.
If you want to call script include from client script, We have to use GlideAjax
https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet/ta-p/2312430
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP