- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2017 08:23 AM
I have a field which is typed as a template_value on a record.
I want to take the values from the field and apply them to another record.
I've done this before and i just cannot think of the code that does it although i'm fairly certain its one - two lines at most.
Can anyone help?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2017 11:24 AM
Hey Neil, I actually had a similar requirement and found you can do something like this,
var gr = new GlideRecord('table_with_template_value_field');
gr.get('someSysID');
var values = ''+gr.u_set_values; //this is your template field
var inc = new GlideRecord('anytable');
inc.get('someSysID');
if (values){
inc.applyEncodedQuery(values);
inc.update() //could also be used in inc.insert()
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2017 11:24 AM
Hey Neil, I actually had a similar requirement and found you can do something like this,
var gr = new GlideRecord('table_with_template_value_field');
gr.get('someSysID');
var values = ''+gr.u_set_values; //this is your template field
var inc = new GlideRecord('anytable');
inc.get('someSysID');
if (values){
inc.applyEncodedQuery(values);
inc.update() //could also be used in inc.insert()
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 12:15 AM
Thanks Nick
Thats a lot shorter and more helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 06:17 AM
It is never too late to tell someone they're awesome. So you're it.
Thanks.
harel