Module Filter base on User's country
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2025 11:30 PM
From this module Site Risks, visible only to users that have role: sn_risk.site_head, sn_risk.site_risk_manager
Link Type
The requirement is that when a user that a member of those roles open the Site Risks he or she can only see the lists of Risks record that Owner is same as his/her country.
Example
YuMi Kim has the role sn_risk.site_head and she is from .
When she open/access Site Risks
She should only see Risks records that the Owner is from Korea, Republic of
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 03:42 AM - edited 02-06-2025 03:43 AM
Hello @Merza Lyn ,
You can add the role in Visibility
And to filter records to show only the records to the location she belongs to is,
you can write a script include and call in the Filter.
You need to dot walk, from Owner > Location > Country || is || javascript: new getUserLocation();
The script include should return the users country.
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2025 12:41 AM
Can you help me with the script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 06:15 AM
Hello @Merza Lyn ,
Click on the Edit Icon of the module and in the Visibility section give the required role and in the filter section provide for Owner > Location > Country || is || javascript: new getUserLocation();
The Script include will look something like the below:
var locationGr= new GlideRecord("sys_user");
locationGr.addQuery('location_matching_criteria");
locationGr.query();
var userIDs=[];
while(locationGr.next()){}
userIDs.push(locationGr.getValue('field_name'));
}
return 'sys_idIN'+userIDs;
}
Mark this response as helpful.
Thank you.
Mahesh.