search for requested for
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 11:49 AM
Trying to find all requests for a specified user. Then creating tasks based on those requests. Getting error
Evaluator: com.glide.script.RhinoEcmaError: Cannot read property "requested_for" from null script : Line(4) column(0) 1: var applications = []; 2: 3: var gr = new GlideRecord('sc_req_item'); //Indicate the table to query from ==> 4: gr.addQuery('Request.Requested_for', current.requested_for); 5: gr.query(); //Execute the query 6: while (gr.next()) { 7: applications.push(gr.short_description.toString());
running script the first part is below
var applications = [];
var gr = new GlideRecord('sc_req_item'); //Indicate the table to query from
gr.addQuery('Request.Requested_for', current.requested_for);
gr.query(); //Execute the query
while (gr.next()) {
applications.push(gr.short_description.toString());
}
var applicationAA = [];
var applicationSS = [];
var applicationBI = [];
var applicationAB = [];
var applicationCA = [];
for (var i = 0; i < applications.length; i++) {
if (applications[i] == 'APCC Access'
what are we missing?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:49 PM - edited 03-08-2023 12:51 PM
Hi,
You'd probably need to adjust line such as:
gr.addQuery('requested_for', current.requested_for);
otherwise, if you're trying to look at the Request level then use:
gr.addQuery('request.requested_for', current.request.requested_for);
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:55 PM
same error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:57 PM - edited 03-08-2023 01:53 PM
Hello,
Please ensure that your "current" object...has a "requested_for" field on it that you can tap into.
We don't know where you're running this, if it's in a business rule or wherever, but it would need have a current object with a requested_for field.
Please share what you have as of now for your script?
For example, please verify that your requested_for field is on the table associated to the "current" object, like so:
This example is for the RITM table.
If not, adjust your script as needed...as otherwise your script should be working fine.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 01:03 PM
I think the error is referring to
current.requested_for
not
gr.addQuery('Request.Requested_for'
What is 'current' in this context?