- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 06:46 AM
ok this may seem silly but i want to know if anyone has figured out how to use a variable in the middle of the . sequence to set/query a field...
so for example say i have the following script...
var query_string = 'string';
var update_var = 'u_variable1';
update_records(query_string, update_var);
update_var = 'u_variable2';
update_records(query_string, update_var);
function update_records(qry,var1){
rec = new GlideRecord('some_table');
rec.addEncodedQuery('qry');
rec.query();
while(rec.next()){
rec.var1 = false; //how do i get this to look at u_variable1 or variable 2 depending on the value of update_var?
rec.update();
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 06:53 AM
Hi Doug,
I believe you can use something like the following:
rec[var1] = false;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 06:53 AM
Hi Doug,
I believe you can use something like the following:
rec[var1] = false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2015 07:22 AM
Sweet thanks works like a charm and keeps me from having to call multiple functions that are all doing the same thing to update multiple fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 12:55 AM
How about when you need to go deeper in the dotWalk?