How to apply the dynamic filter for the specific table using the Script Include?

Karuppasamy
Tera Contributor

I have created one Script Include for the dynamic filters.

 

Detail - If the user is from the LOB A, he must be able to see only the records contain LOB A. Filter - LOB = A.

             If the user is from the LOB B, he must be able to see only the records contain LOB B. Filter - LOB = B.

 

In the script include,

 

1. I have taken the user name who is entering into the Specific table. gs.getUserName();

2. I have checked the user name in the groups table and got the groups name belongs to the user.

3. If the user is from the correct assignment group, redirect the user to the specific link belong to the lob.

 

4. In the Specific table, in the arguments checkbox, I am calling the script include through different methods,

    a) javascript: new ScriptInclude().function name();

    b) javascript: function name();

 

 But nothing worked for me. I need to know whether my approach is correct or not. How to remodify the script include code and how to pass the script include in the arguments box?

2 REPLIES 2

Mark Manders
Mega Patron

Please share your script, because it could very well be that something is wrong in there. But what are you trying to do? Just show them 'their' list or limit their access completely to the other ones? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Josh Gold
Tera Expert

@Karuppasamy So if I'm understanding correctly, all you want to do is restrict visibility on records for specific users from specific tables, correct?

 

You can achieve that without script using Unito's low-code 2-way integration for ServiceNow. Here's a guide I put together on how to connect records from two different tables. The example there is about creating incidents based on cases and keeping them in sync, but the same logic can be used to sync specific records to a table for specific users. 

 

I could probably put together a quick demo for you if this is something that interests you, or you can hop on a call with one of my colleagues!

 

Let me know what you think!