- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 04:14 PM
We are trying to use an advanced reference qualifier for our M2M references to filter to specific "hardware". From reading the forums it looks like "parent" and "current" exists; however, when I do a javascript:gs.error("asd" + parent); I get
org.mozilla.javascript.EcmaError: "parent" is not defined.
Caused by error in sys_dictionary.475b474879f110107f613a6fa3b72983 at line 1
==> 1: gs.error("asd"+ parent);
and when i do a javascript:gs.error("asd" + current); i get
asdnull |
What can i do to dynamically filter based on parent or the current record?
Edit for my context:
I have a table called POAM and a table called Hardware. I created a many to many between the 2. On the POAMs form, I have added a related list. When you click edit we are wanting it to show a filter list of hardware.
So in the many to many table, I am editing a reference qualifier for hardware. for testing I am only printing out logs because nothing was working (and it ended up being because current was null). So i added javascript:gs.error("asd" + current);. I then go to the poams table, and click "edit..." on the hardware related list. This should kick off the reference qualifier script (in does) and when i review the logs i get asdnull. So current is null when coming from a related list. Also, parent is not a defined object at all...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2020 10:37 AM
Solution proposed is : Hello Kyle, We are placing this case in Solution Proposed, based on the following information. Issue Summary: Related List Reference Qualifier "current" object is returning null Solution Proposed: The behavior you are seeing here unfortunately is expected. Using Advanced Reference Qualifiers containing 'current' with List Collector type variables is not currently supported as the value for current could change and cause unexpected results. Please see the following knowledge article for more information. https://hi.service-now.com/kb_view.do?sys_kb_id=3f807eaedb7e2f009540e15b8a961961 Next Steps: If you feel I addressed your questions properly and provided relevant information that resolved the issue, please accept the solution and close this case. Otherwise, if you have a moment, you may call me or provide additional information in this case so we may further discuss this issue. Thank you, Jeff Menkel Office: +1 407-499-2550 ServiceNow | Works for you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 11:10 PM
Sorry just checking if you saw my replies? I appreciate the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 05:04 PM
If you can't get the filter you need with a Simple qualifier (even via dot-walking/related fields), a typical Advanced reference qualifier is either something like
javascript:"department=" + current.department; (or current.variables.department if using this on a variable)
or calling a function in a script include where you can do pretty much anything, usually some GlideRecord querying pushing sys_ids to an array, then returning the joined array. So that looks like this
javascript:new Companies().getFilteredCOs();
With a return in the SI something like
return 'sys_idIN' + arr.join(',');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 05:53 PM
Yep, exactly. What i stated above is the current object is null... so if i do current.field_name or current.variables.field_name it would say current object is null...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 06:03 PM
I don't know that javascript:gs.error(current.any_field); is valid for a reference qualifier. Have you tried the standard format as a basic example to see if any results are returned?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 06:07 PM
You are correct, but using gs.error or gs.info is a way to "log" so i can see what certain things do. So current is a null object... so i cannot reference something like current.department as it will error.