- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 11:56 PM
Hi All,
I have created a Reference field in the Requested Item.(Requester Group- Reference to sys_group table).
The requirement is to show the logged in user's group in that field without adding any reference qualifier in the dictionary because this field is been used in other scripts.
Please help in this.
Thanks,
Samiksha
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:38 AM
Please use the following BR with the script to populate the first group upon RITM creation.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("user", current.requested_for);
gr.query();
if (gr.next()) {
current.u_requester_group = gr.getValue('group'); //Change field name as per your configuration
}
})(current, previous);
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:38 AM
Please use the following BR with the script to populate the first group upon RITM creation.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("user", current.requested_for);
gr.query();
if (gr.next()) {
current.u_requester_group = gr.getValue('group'); //Change field name as per your configuration
}
})(current, previous);
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:54 AM
To populate Logged in user (requester) group, instead of requested for use the following script.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("user", gs.getUserID());
gr.query();
if (gr.next()) {
current.u_requester_group = gr.getValue('group'); //Change field name as per your configuration
}
})(current, previous);
Anvesh