GlideRecord - Query by parent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 03:05 PM
I have just started using GlideRecords in the last week or so and am loving the. A question I have is how to query project tasks based on parent. This is what I am attempting but it is not working... This is just an example however I will be doing updates using the scripts background module.
var gr = new GlideRecord('pm_project_task');
gr.addQuery('parent', 'PRJ0010604');
gr.query();
while (gr.next()) {
gr.assigned_to == "Tony Balestreri"
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 03:06 PM
And I did have the ";" after the "tony balestreri"...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 03:22 PM
The value of parent will be the sys_id of the referenced record, not its task number. You could do the following:
gr.addQuery('parent.number', 'PRJ0010604');
And assigned_to needs a sys_id, not the user's name, but you can do the following:
gr.assigned_to.setDisplayValue("Tony Balestreri");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 03:34 PM
Perfect, thanks!
