- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 02:57 AM
Greetings,
I was hoping for assistance, likely a simple answer but too much time has been spent already trying 70 different methods and I am sure someone here will know it.
Stripped down to its basic form I am trying to addQuery against 1 field on a table and 1 field on another table, stepping through a reference field.
var getCvr = new GlideRecord('pm_portfolio_project');
getCvr.addQuery('project.u_start_date','=','u_project_start_date');
getCvr.query();
while(getCvr.next()) {
//do stuff
getCvr.update();
}
I have confirmed the project.u_start_date works fine, I am assuming its comparing 'u_project_start_date' as a literal string and not evaluating the field from the original table. Any advise?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 08:34 AM
Replace the addquery with this
getCvr.addEncodedQuery('pm_project.start_dateSAMEASstart_date@day')
If this doesn't work, open the table > filter the record as needed > right click on the query end >do a copy query> use it in encoded query

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 05:43 AM
Exactly. It will treat anything within quotes as a string lliteral.
So try
getCvr.addQuery('project.u_start_date',u_project_start_date);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 08:19 AM
Gave it a run, pretty reasonable but to no avail.
Here is the code, just stamping a string field to test functionality.
var getCvr = new GlideRecord('pm_portfolio_project');
getCvr.addQuery('project.u_start_date',u_project_start_date);
getCvr.query();
while(getCvr.next()) {
getCvr.u_gtg_plan = 'Found a match';
getCvr.update();
}
Both date fields are basic, no time.
Case 1 = Expected Positive
Case 2 = Expected Negative
Case 3 = Earlier Test with simple addQuery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 08:34 AM
Replace the addquery with this
getCvr.addEncodedQuery('pm_project.start_dateSAMEASstart_date@day')
If this doesn't work, open the table > filter the record as needed > right click on the query end >do a copy query> use it in encoded query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 09:03 AM
And it found a match! Variable string was different but you're right once I grabbed the query from the filter and used encoded it worked. Thank you so much.