- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 08:06 AM
Hi there,
I have a strangre requirement and not sure how to approach it.
Requirement:
If user who has no manager in user table tries to open this catalog item then we should alert the user with message ‘Hey, seems you don’t have manager assigned!’.
How would I go about this? Would I start with a business rule? And how would I qualify the 'current user has opened CI of interest'?
Any help would be appreciated.
Kind regards,
G
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 08:41 AM - edited 10-11-2023 08:41 AM
Hi @gunishi
Try this.
#Client Script OnLoad
var ga = new GlideAjax('CatalogUtilAJAX');
ga.addParam('sysparm_name', 'getManagerID');
ga.getXMLAnswer(function(response){
if(response !== ''){
alert('Hey, seems you don’t have manager assigned!');
}
});
#Script Include AJAX
/**
* get Manager ID of current user
*/
getManagerID: function(){
return gs.getUser().getManagerID();
},
Let me know if it works for you
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 08:41 AM - edited 10-11-2023 08:41 AM
Hi @gunishi
Try this.
#Client Script OnLoad
var ga = new GlideAjax('CatalogUtilAJAX');
ga.addParam('sysparm_name', 'getManagerID');
ga.getXMLAnswer(function(response){
if(response !== ''){
alert('Hey, seems you don’t have manager assigned!');
}
});
#Script Include AJAX
/**
* get Manager ID of current user
*/
getManagerID: function(){
return gs.getUser().getManagerID();
},
Let me know if it works for you
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 02:04 AM
Hi @Tai Vu
This is perfect, thank you! I actually already had a get manager function so this is super useful.
Thank you again.
Kind regards,
G