On submit client script only for "close task" UI action

sreejith05
Giga Expert

Hi Team,

I have a client script like below to ensure one field is mandatory while closing the task it is working fine but my issues is even if i need to update or save the task then also it is not allowing me to do. In short my requirement is to run the script only when the "close task" button got clicket not the "save" or "update" button/UI action.

 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@sreejith05 

You can check whether which UI action got clicked or not in onSubmit client script as below

give the action name

function onSubmit(){

if(g_form.getActionName() == 'close_sc_task'){

// your code here

}

}

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@sreejith05 

You can check whether which UI action got clicked or not in onSubmit client script as below

give the action name

function onSubmit(){

if(g_form.getActionName() == 'close_sc_task'){

// your code here

}

}

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

sreejith05
Giga Expert

Thanks Guys i put the condition initially and it worked smoothly 🙂