- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 08:05 AM
Hi all,
I am trying to set Model Category and Model on the alm_hardware table via template, but am not able to do so. It seems that dot walked fields, or maybe reference dot walked fields, cannot be applied via template via script. In my script include, I am using the applyTemplate method(), and I believe this is working because all other fields are being set properly. ACL's are not an issue because I can create a new record and use the same template and it works.
HELP!
var gr = new GlideRecord(table_name);
gr.initialize();
gr.applyTemplate(template_name);
gr.setTimeout("",2000); //is it a timing issue?
gr.insert();
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 08:42 AM
It's undocumented, but I have seen this code in Event Management business rule where you can apply a template via SysId using the following syntax:
GlideTemplate.get(template.sys_id).apply(GlideRecord)
You might want to try this instead of using applyTemplate() and see if this works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 09:34 AM
Used GlideTemplate and it produces the same result
It applies the template but unable to update Model and Model Category
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 09:38 AM
Actually, I was wrong.
Had an error in the code, using GlideTemplate works!!!
Thank you guys so much