Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Kirk2
Giga Contributor

Edit your UI action and add


task.priority = current.priority;



this copies the incident priority over to the task.


Of course this assumes that you have the same priority levels on the task.


Kirk Smith thanks for the answer. I tried that, however it did not work.


I think I have found the root cause of my issue, or why when I click 'New' in the Incident Tasks, I cannot copy the priority.



Just to mention before that, I tried with a client script (I have the same for problems and problem tasks and it works) which is OnLoad, set the the Incident Task table and has the following as code:



function onLoad() {
    var refIncident = g_form.getReference('incident');


    if (g_form.isNewRecord() && refIncident.priority > 0) {
          g_form.setValue('priority', refIncident.priority);
    }
}



The issue which I suspect is that have a UI policy on Incident, called 'Priority is managed by Data Lookup - set as read-only'only, and this prevents my script from being able to lookup the priority of the parent incident. And I cannot find a way to work around that.



Moreover, this is weird... I tried a workaround - to create a UI policy , which sets Priority to mandatory for Incident Task. But it does not work!?


Here is my setup below, I can't find anything wrong with this...



find_real_file.png