- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 08:14 AM
Hi All,
I am passing sys_id of the user which was fetched in the client script to below script includes and storing it in variable called userID.
For admins, In this query its fetching the records correctly for both active and inactive. But if user is inactive the data is not getting fetched for non-admins through catalog.
How to query even inactive users for non-admins ? Please help
Script Include:
getAssetdetails: function(){
var userID = this.getParameter('sysparm_user_name');
var almHW = new GlideRecord('alm_hardware');
almHW.addQuery('assigned_to',userID);
almHW.addQuery('install_status',1);
almHW.addQuery('substatus',null);
almHW.addQuery('model_category','88uu99886537373883883');
almHW.query();
almHW.getRowCount();
..................etc etc
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 09:03 AM - edited 05-31-2023 09:50 AM
Hi @Harsha M V ,
Its "user query" business rule. I am attaching screenshot of this business rules as well. I think this business rule might be conflicting with your script. You may try by deactivating this BR in dev and check if the results are coming as expected even for non admins or not and then if it works you may modify this BR as per your use case however its OOB BR and OOB components are not recommended to be modified. In case if this does not work, check if script include is executing or not in case of non admins as roles could be specified in ACL on the client callable script includes and if non admins does not possess that role, the script include would not execute for them.
Amish Ranjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 08:25 AM
Hi @Harsha M V ,
This is happening because of user query business rule which is triggering before querying the sys_user table which restricts querying inactive user records for non admins. Please have a look at it once.
Amish Ranjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 08:52 AM
Hi @AmishRanjan2 ,
But we are not querying user table, we are querying alm_hardware table which has a reference record to user table.
May i know which is that query business rule? Can you please provide name of the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 09:03 AM - edited 05-31-2023 09:50 AM
Hi @Harsha M V ,
Its "user query" business rule. I am attaching screenshot of this business rules as well. I think this business rule might be conflicting with your script. You may try by deactivating this BR in dev and check if the results are coming as expected even for non admins or not and then if it works you may modify this BR as per your use case however its OOB BR and OOB components are not recommended to be modified. In case if this does not work, check if script include is executing or not in case of non admins as roles could be specified in ACL on the client callable script includes and if non admins does not possess that role, the script include would not execute for them.
Amish Ranjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 09:13 AM