Has anyone been able to successfully create task from the incident form? I would greatly appreciate any assistance on how to accomplish this.

dgrayson
Kilo Explorer

We are currently using the 'create a problem', 'create a defect' etc... from the incident form but I don't see where there is an UI action for 'create a task'.

6 REPLIES 6

bt6lw
Giga Contributor

This is very easy.




It depends on what you want to achieve. The context menu - where you right click, and create a problem / etc are defined UI Actions.



You can simply define a UI Action called "create a task" which will insert a record as per current incident information into the task table. I don't think this will be useful though, as you want to seperate your tasks by class, and not push task data in at a parent level.


mitzaka
Mega Guru

What I did was to create a new table, which extends the Tasks table, the main reason being is the better future perspective approach for maintenance and it gives us much more flexibility. You could name it Incident Tasks'for example.


 


In the incident record, I added a section called Incident Tasks. From there users can create incident tasks and the Parent ID field is automatically populated with the ID of the incident you are creating task from.


 


 


Kirk2
Giga Contributor

We created a section tab on the incident form called "Related Tasks"   the personalized the new tab to look at the Task->Parent from the available slushbucket.


Then we created the below   UI action on the incident form that relates to the task table.



Name = Create Task


Table = Incident


Active = True


Show Insert = True


Show Update = True


Form Button = True


Form Context menu = True



Condition = gs.hasRole("itil")



Script =


var task = new GlideRecord("task");  


task.short_description = current.short_description;


task.priority = current.priority;


task.assigned_to = gs.getUserID();// add the user as the assigned to


task.description = current.description;  


// add the task information to a related task tab at the bottom of the incident form.


task.parent = current.sys_id; //new relationship through related tasks tab


var sysID = task.insert();


//current.parent = sysID; // out of the box relationship through parent field


var mySysID = current.update();



gs.addInfoMessage("Task " + task.number + " created");  


action.setRedirectURL(task);  


action.setReturnURL(current)



Hope this helps


K


mitzaka
Mega Guru

I have extended the Task table to Incident Task table and I have added a section Incident Tasks to the related lists in incidents. Looks like this:


find_real_file.png



When you create a new task though, the priority is set to a default value of 5.


find_real_file.png


I am looking for a way to lookup the priority of the parent incident and set the same priority of the incident task. Has someone done this?


I was thinking of eventually making a new UI action instead of 'New' in Incident Task related list.