- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 01:35 PM
I have form A and form B I am looking to update form A the assignment group with the assignment group from Form B when this value is changed in Form B. I tried the following 2 below sorry new to GlideRecords so any help would be awesome.
First 1
ar gr = new GlideRecord('hr_case');
gr.get('number');
gr.assignment_group = current.assignment_group;
gr.update();
Second
var gr = new GlideRecord('hr_case');
gr.AddQuery('number',current.u_hr_case);
gr.Query();
gr.assignment_group = current.assignment_group;
gr.update();
Thanks
John
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 01:47 PM
Hi John,
The key to knowing how to query and update the records is how these two tables are related.
You are obviously looking to update a record on the hr_case table. What field on 'current' is pointing to that table? Put that in the 'FIELD' below.
var gr = new GlideRecord('hr_case');
if (gr.get(current.getValue('FIELD')) { // Replace FIELD with the reference field from the current record that points to hr_case
gr.assignment_group = current.assignment_group;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 01:47 PM
Hi John,
The key to knowing how to query and update the records is how these two tables are related.
You are obviously looking to update a record on the hr_case table. What field on 'current' is pointing to that table? Put that in the 'FIELD' below.
var gr = new GlideRecord('hr_case');
if (gr.get(current.getValue('FIELD')) { // Replace FIELD with the reference field from the current record that points to hr_case
gr.assignment_group = current.assignment_group;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 04:13 PM
This is what I added with an After condition but nothing
var gr = new GlideRecord('hr_case');
if(gr.get(current.u_hr_case))
gr.assignment_group = current.assignment_group;
gr.update();