- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 11:08 PM
I need to check one "checkbox" below before fulfiller click "close task" from banner to close the task.
When I change task state, OnSubmit script works fine but when task is closed from banner, OnSubmit script do not work.
Please help
Thanks
Mohammad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2020 11:34 PM
Hi,
2 approaches
1) make that variable as Mandatory for Catalog Task
OR
2) update the OOB UI action as below
Note: give the catalog item sys_id for whose Task you want to run this for
function closeTask(){
var catItemSysId = g_form.getReference('request_item').cat_item;
if(catItemSysId == 'Your Catalog Item Sys ID'){
var variableValue = g_form.getValue('checkbox_variableName');
if(variableValue == ''){
alert('Please select the checkbox before closing the task');
return;
}
}
g_form.setValue('state', 3);
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'close_sc_task');
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
updateTask();
function updateTask(){
current.state = 3;
current.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 09:41 AM
yes "Close Task" is on table sc_task only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 10:39 AM
Hi,
Did you create another Close Task button on sc_task or update the OOB one?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 10:44 AM
yes I created another one.
If I need to update existing one, I need to enable client script will that be ok?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2020 09:26 AM
Hi,
since you created new one on sc_task it is showing 2 buttons.
Ideally you could have updated the existing one
Please update existing UI action and inactivate the newly created
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 02:54 AM
Hi Mohammad,
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
If not, please let us know if you need some more assistance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader