- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2015 05:52 PM
I have 2 reference fields, one is requester the other is requester group(s). The requester group gets filled with the requester's group(s). It is currently filling them with no problem, what I would like it to is to throw an alert to the window if the requester group(s) reference field does not any selections in it to select. In other words, if the requester currently is not in any groups, throw the message to the window, else do nothing....
This is the current scripting I have in my workflow in Additional Approvers Script section :
answer = [];
var approvers = new GlideRecord('sys_user_grmember');
approvers.addQuery('group', current.u_requestor_group.sys_id); //Assumption: u_requestor_group is not null
approvers.query();
while(approvers.next()) {
if(approvers.user.toString() != current.requested_by.toString())
{
answer.push(approvers.user.toString());
}
}
Can anyone help me with this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2015 08:12 AM
I think you need the users sys_id
try
var uID = g_user.userID;
As the 'sys_user_grmember' tables user field is a reference field to the sys_user table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2015 07:51 AM
try while(grmember._next())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2015 07:58 AM
Daryll,
That did not work... Could it be that I am pulling the username and not the full name? I am filtering on the user field, which from my knowledge displays the full name, not username. If that is the case, how do I pull the current users full name on page load?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2015 08:12 AM
I think you need the users sys_id
try
var uID = g_user.userID;
As the 'sys_user_grmember' tables user field is a reference field to the sys_user table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2015 08:15 AM
If that doesn't work try changing
grmember.addQuery('user', uID);
to
grmember.addQuery('user.sys_id', uID);