Close Catalog Task

abhiyadav2001
Giga Expert

Hi,

 

I tried closing task from UI button as follows

 

task.state = 3;

task.close_notes ='Request has been completed';

task.update();

 

I tried using 'current' as well.. but results in no change.

 

However, its not updating the task.

 

What am I missing here ?

 

Thanks,

Abhijeet

1 ACCEPTED SOLUTION

Oh yes it shouldn't be client callable it should just run server side, uncheck that.


View solution in original post

9 REPLIES 9

marcguy
ServiceNow Employee
ServiceNow Employee

is the ui action actually being run on the task itself? is the button on the task form?



if so then current. is the correct syntax not task.



if it's on a change though for instance and your closing change tasks then you would need to do a query for the tasks and close them, so let us know where the UI Action/button lives first, then we can take it on.


Hi,



I am on Task table. ( catalog task form)


Thanks,


Abhijeet


ok so if your pressing the button in the same record you want to close you can just use current.fieldname = 'value', current.update()



to close the catalog task make sure your setting the value of the task state to it's closed value i.e:



current.state = 3;


current.close_notes ='Request has been completed';


current.update();


Hi mguy,



Hello Kalaiarasan,



I tried by using 'current' and 'task' both.. Unfortunately, it isnt working..


The UI action is set as client callable. Is there anything I need to check ?



Thanks,


Abhijeet