- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 12:57 AM - edited ‎12-15-2022 01:06 AM
Hi!
I'm stuck on one task, where I need to create custom icon link widget which can be seen only by users who are from specific country.
I cloned Icon link widget , did visual changes to it(icon, location in portal, links etc now I'm working on server side script and HTML part.
My goal is to custom server side script so widget shows only for people which are from location "SE".
I have checked community and some other forums but cannot make it work.
Can you please comment what I need to correct so the widget is only visible for logged on user from country "SE"?
Thank you in advance
(function(){
var gr = $sp.getInstanceRecord();
data.href = $sp.getMenuHREF(gr);
data.target = options.target || "";
checkCondition();
function checkCondition(){
var locationId = gs.getUser().getLocation();
var usrLocation = new GlideRecord('cmn_location');
usrLocation.addQuery('sys_id', locationId);
usrLocation.query();
if(usrLocation.next())
{
if(userRegion == "SE")
{
return true;
}
else {
return false;
}
}
})();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 10:24 PM - edited ‎12-16-2022 06:55 AM
(function(){
var gr = $sp.getInstanceRecord();
data.href = $sp.getMenuHREF(gr);
data.target = options.target || "";
data.region = false;
var user = new GlideRecord("sys_user");
user.addQuery("sys_id", gs.getUserID());
user.setLimit(1)
user.query();
if (user.next()) {
if(user.country == 'SE'){
data.region=true;
}
}
})();
Hi! I figured it out myself, using different scripting approach. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 10:24 PM - edited ‎12-16-2022 06:55 AM
(function(){
var gr = $sp.getInstanceRecord();
data.href = $sp.getMenuHREF(gr);
data.target = options.target || "";
data.region = false;
var user = new GlideRecord("sys_user");
user.addQuery("sys_id", gs.getUserID());
user.setLimit(1)
user.query();
if (user.next()) {
if(user.country == 'SE'){
data.region=true;
}
}
})();
Hi! I figured it out myself, using different scripting approach. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 10:46 PM