Create task template in a workflow (sc_task table)

Milan13
Giga Expert

Hello,

I need to create templates for "Create Task" workflow activity which generates an sc_task record (associated with sc_request record and sc_req_item record - service catalog item record to which the workflow is assigned to.

What I need is a task  template with pre-set up "assigned to", "short_description" and "instructions" so I would just add a template to the "Create Task" and these fields would generate automatically.

From what I have read the template should be set-up on sc_cat_item level but that makes me a bit confused as when I try to add "Template" in the form layout it's just not there.

Any help on this?

Many thanks,

Milan

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

Hi there,

I don't know if there is an out-of-the-box reference field for example, with which you can select a Template. Never seen it, but maybe anyone knows.

Though, we do apply templates scripted in our environment. Works fine. Below copy/paste:

var grTask = new GlideRecord(grScheduledTask.task_type); 
grTask.initialize();
new GlideTemplate.get(grScheduledTask.task_template).apply(grTask); 
grTask.insert();

So you could try something like below in the script field of the Create Task / Catalog Task:

new GlideTemplate.get('template_sys_id').apply(task);

Is untested. So not sure if you can do the apply(task). Though, just test.

On docs there's also a page about applyTemplate:
https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/form-administrati...

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Milan13
Giga Expert

Hi Mark,

I found the option "Task values from" in the "Create Task" Activity Properties and chose "Template" which was the easiest way how to do this so the issue is solved.

Appreciate your help anyway.

Milan