Restrict Knowledge Articles based on Users Country

Pradeepa Boopat
Tera Contributor

Hi @Ankur Bawiskar ,

Based on user country, Knowledge article need to restrict.

I haved created User Criteria, I tried with some scripts but it's not working.

Can you please help me with scripts.

7 REPLIES 7

Peter Bodelier
Giga Sage

Hi @Pradeepa Boopat ,

 

The easiest way is to use no scripting at all.
You can extend user criteria fields, as long as this field is available on the user record.


Please see this docs how to do this.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Pradeepa Boopat ,
I trust you are doing great.

To achieve this, you can follow these steps:

Step 1: Create a new User Criteria record:

  • Go to "User Administration" > "User Criteria".
  • Click on "New" to create a new record.
  • Provide a name for the User Criteria, such as "Country Restricted Knowledge".
  • In the "Advanced" tab, add the following script to define the condition:
function evaluateUser(user) {
    var userCountry = user.getValue("country"); // Assuming 'country' is the field name for the country in the user table.
    return (userCountry === gs.getProperty("glide.ui.default_country")); // Change 'glide.ui.default_country' to the desired default country.
}

Step 2: Apply the User Criteria to the Knowledge Base:

  • Go to the Knowledge Base you want to restrict.
  • Open the Knowledge Base record.
  • Scroll down to the "User Criteria" related list.
  • Click on "New".
  • Select the User Criteria record you created in Step 1.

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



@Amit Gujarathi  Country field is not in User table.

Yes it is... Maybe not visible on your form, but it is available on the table.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.