- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2024 12:12 AM
Hello,
I am trying to create a Relationship:
Queries Table: Sys_User
Applies to Table: Sys_User
For the Query With I am using the following:
This gives me all the Directors of the Department that matched the current user records department.
I am trying to narrow it down the direct Director of the current user record within the same department
For Example: View User Record John Doe
John Doe Manager: Jane Doe (Title starts with Mgr)
Jane Doe Manager: Timmy D (Title starts with Sr Mgr)
Timmy D Manager: Edgar J (Title Starts with Dir) - return Edgar D in the related list
I tried the following:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2024 03:22 PM - edited 08-17-2024 05:41 PM
Seems you didn't read the information at the link I posted. And looking at the last attachment of your script, you have at line 4
'var msg= current.addQuery('sys_id',parent.sys_id);'
and the debug doesn't show for lines 6 and 7
gs.log("Attempt for Current SysID: " + msg.sid);
I believe you may need to use parent.sys_id ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2024 12:56 AM
The code and logs don't match, can you provide the complete script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2024 12:16 PM
This is one of the scripts that is complete in the Relationship Record in the Query with section:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2024 09:29 AM
The 'msg' variable from your 'var msg = current.addQuery('sys_id',parent.sys_id);' is not what you expect. See:
which has:
Returns
Type Description
GlideQueryCondition A reference to the GlideQueryCondition that was added to the GlideRecord.
the log message is empty in your screenshot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2024 12:23 PM
the log message are recorded as empty in the logs list view
attached is a sample of what "msg" is returning, if this is a reference, how would I be able to get the current user record being viewed sys_id?
From Navigator I got to user from users and groups, it brings up the user list view, when i click on a user record, the log statements return as "sysid=xxx" as "msg", the other attempts to get the current user record that i am on return a blank log state: gs.log(current.sys_id.toString());
gs.log("Diff Function Current User SysID" + curr); log statement says cannot find user for sysid=xxx, since that is what msg returns