Create Template from Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2013 09:59 AM
Hi,
Does anyone know if there is anyway that I can create a template "sys_template" from a business rule populating the template field using values from a from on a table?
I have created an "Event Management" Table with an Event Task table. Sometimes event tasks need to be schduled so I need to be able to create a scheduled job (Which I have managed to do via a business rule) and create a template for "Event Task" and fill in the template fields.
Thanks in advance for any help
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2013 04:00 AM
You have to join javascript variables with the string. Try this:
var etask = new GlideRecord("sys_template");
etask.initialize();
etask.table = 'u_event_task';
etask.name = current.number + " - Event Task";
etask.short_description = current.u_task_title;
etask.template ='assignment_group=' + current.u_task.resolver_group +'^short_description=' + current.u_task_title + '^description=' + current.u_task_description + '';
etask.insert();
Cheers,
Kostya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2013 04:37 AM
Thank you very much, I was close, I just had the '^' in the wrong place.
All good now 🙂
Thanks for your help
Cheers
Dan