logged in user to see only it's own assigned cases

Damian Martinez
Mega Sage

Hello Community, I hope everyone is ok.
I have set up a new user and I have been told that this new user only needs visibility on the cases assigned to him.
Does somebody know how to accomplish this? I guess I have to setup ACL or business rule, but not sure.

Thanks in advance!

18 REPLIES 18

Hi Damian,

You need to write the condition in condition field present in advance section.

Please mark this correct / helpful based on the imapct.

Thanks,

Mohit Kaushik

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Using a query rule is OK as well, but you'll have to be a bit more careful than with ACL. The query rules will limit what results will be queried, while ACL will let you query all and limit what can be accesses. So for example if you have 100 records and both ACL and query rule limit the same 10. Query rule will only retrieve 90 records. ACL is run after query and it will hide 10 records AND if the user looks at the whole table (without filters) they will see a text saying that x amount of records where hidden due to security. Query rule does not tell you this.



Now with query rule if you just use the condition Ankur gave:

gs.getSession().isInteractive() && gs.getUserID() == 'specificUserSysId'

You're saying that trigger BR if current user is one specific user. Of course you're not supposed to hard code such a value. You'll have to figure out a condition where it will trigger. For example if user has certain role, company, title and so on.

Your query rule could say this in the script section under advanced tab: 

current.addQuery('assigned_to', gs.getUserID());

In this case if the condition is true, the query rule will force a condition on the system when it retrieves records and the user would only see records where they're the assigned to. Query rules also have a large fault where if you add a OR clause
find_real_file.png
The resulted list of records will not work properly. The list could show INC0001, INC0002,... and when you click on INC0001 it opens another record like INC0004 instead.



If you're hardcoding this to 1 single user, then if another user is created you have to change the condition to consider them as well, so never design these for one  specific record or user and make them dynamic.

 

ALSO query rules are not the best practice way of doing this.
ACL's are the recommended way and are actually faster as well.

Hi,

in advanced section under condition field

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Abhijit4
Mega Sage

Hi,

In ACL script section, you can check if gs.getUserID()=="sys id of the new user" //as a best practice store sys_id in system property and access in ACL. I would still suggest you to create new Role and assign it new user.

However, this is not quite easy. Even if you provide your new user access to only his assigned records with your new ACL parallelly other ACL will provide him all access anyway. So first you would need to review your existing ACL's and make sure that new user is not passing access through those existing ACLs.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit

 

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Damian Martinez
Mega Sage

Hello All,
Thanks for your advices.

First I tried ACL, however a few points: The * value is not available to replace None.
And Second I get and error message that I don't understand:

find_real_file.png

Since the user needs to update its own records I guess I need to create another ACL operation write correct?

As for the business rule, will this work for the user to update its own records?

Thanks.