The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Trying to automatically create a Catalog Task when a RITM is created

prudhvig
Tera Expert

Hi,

I have developed a catalog item which when filled and submitted would create a Request and RITM under it. Along with this, I want a Catalog Task to be automatically created with a description "Default Task".

I am quite new to Servicenow and unable to find a way to solve this. Please help.

Thanks in advance.

1 ACCEPTED SOLUTION

Oh My Mistake.



Try this:



  1. var gr = new GlideRecord('sc_task');
  2. gr.initialize();
  3. gr.request_item = current.sys_id;
  4. gr.short_description = "Sample Description";
  5. gr.description = "Sample Description"
  6. gr.insert();

View solution in original post

18 REPLIES 18

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,



You can create this using catalog task activity in workflow attached to your Catalog item.



There you can set short description of your activity as well.



Thank you,
Ashutosh




Please Hit ✅Correct, ��Helpful, or ��Like depending on the impact of the response


Gowrisankar Sat
Tera Guru

Hi Prudhvi,



You can make use of Task Activity by building a workflow, for which scope of scripting is very less.



else:



You can create a Business Rule on sc_req_item table and write this script. Make sure you restrict this Busienss Rule only to this catalog item.



  1. var gr = new GlideRecord('sc_task');  
  2. gr.initialize();  
  3. gr.insert();

Hi Govind,



Thanks for the reply.



I am trying to use your BR. However, I also want to add a description into this. For this, can I add the following line to the code?



  1. var gr = new GlideRecord('sc_task');
  2. gr.short_description = "Sample Description"
  3. gr.initialize();
  4. gr.insert();


Is this right? And, Should the BR be an After Insert, Update ?



Please let me know. Thanks.