- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 10:02 AM
Great, was hoping there was some logging or debug mode. How can I accomplish that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 10:05 AM
I think for the internal users will have an snc_internal role. Can you update your script and include snc_internal role check for internal and snc_external for external users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 10:33 AM
Our developer seems to have figured this out. Looks like a GlideAjax script is needed. To be honest I don't really follow the script so if anyone would like to attempt to explain it I would appreciate it.
function onLoad() {
//Type appropriate comment here, and begin script below
var aj = new GlideAjax('GetInternalExternalCSM');
aj.addParam('sysparm_name','getExternal1');
aj.getXMLAnswer(fun);
//Type appropriate comment here, and begin script below
function fun(answer)
{
var obj = JSON.parse(answer);
if(obj.internal == true)
{
g_form.setReadOnly('u_internal_external',false);
g_form.setMandatory('u_internal_external',true);
}
else if(obj.external == true)
{
g_form.setVisible('u_internal_external',false);
}}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2016 01:21 PM
Your script is making an ajax call to a Script Include called 'GetInternalExternalCSM' which is not available to us. It seems to return "internal" and "external" properties, which are used to set the form properties.
I still believe our investigative approach would've eventually revealed why g_user.hasRole('snc_external') wasn't returning the expected values when an external user was logged in. I'd prefer using g_user.hasRole('snc_external') since it provides a simpler and cleaner way of determining the user role. You might continue looking into it and it might reveal a few things that can help you down the road.
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2025 11:58 PM - edited 12-03-2025 11:59 PM
I am also facing the same issue related to g_user.hasRole('snc_internal') in catalog client script.
Trying to display does logged in user have this role or not. It works for admin user but not for user having snc_internal role not admin role. Both users are having the snc_internal role but for the user having only snc_internal not admin it wont work.