- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2018 03:40 AM
Unfortunately even though this resolves the issue around submitting the clear code field, it brings about another issue where the work order task is not moved to the state of 'Closed incomplete'. I imagine the g_form.save() action is now abruptly ending any processing that happens in my processing script where a call is made to the appropriate 'sf_state_flow' table to correctly update the state of the WOT.
Processing Script
if ('false' == cancelled) {
var taskToClone = new GlideRecord("sm_task");
if (taskToClone.get(task_id)) {
var className = taskToClone.sys_class_name;
taskToClone = new GlideRecord(className);
taskToClone.get(task_id);
var clonedTask;
if (GlidePluginManager.isActive('com.snc.wm_questionnaire')) {
var gr = new GlideRecord("sf_state_flow");
gr.get(state_flow);
taskToClone.state = gr.end_text;
if (new FSMQuestionnaireHelper().pendingQuestionareExist(taskToClone)) {
response.sendRedirect("sm_task.do?sys_id=" + taskToClone.sys_id);
gs.addErrorMessage(gs.getMessage('Please complete mandatory questionnaires.'));
} else {
taskToClone = new GlideRecord(className);
taskToClone.get(task_id);
if (yesno == 'y') {
// Clone the current task
var clonedTask = new SMTask().cloneTask(taskToClone, true);
getWorkNote(clonedTask);
}
taskToClone.work_notes = work_notes_update;
new global.StateFlow().processFlow(taskToClone, state_flow, 'manual');
if (yesno == 'y') {
// redirect to the newly cloned task
response.sendRedirect("sm_task.do?sys_id=" + clonedTask.sys_id);
gs.addInfoMessage(gs.getMessage("Cloned from {0}", taskToClone.getValue('number')));
} else {
response.sendRedirect("sm_task.do?sys_id=" + taskToClone.sys_id);
}
}
} else {
if (yesno == 'y') {
// Clone the current task
var clonedTask = new SMTask().cloneTask(taskToClone, true);
getWorkNote(clonedTask);
}
taskToClone.work_notes = work_notes_update;
new global.StateFlow().processFlow(taskToClone, state_flow, 'manual');
if (yesno == 'y') {
// redirect to the newly cloned task
response.sendRedirect("sm_task.do?sys_id=" + clonedTask.sys_id);
gs.addInfoMessage(gs.getMessage("Cloned from {0}", taskToClone.getValue('number')));
} else
response.sendRedirect("sm_task.do?sys_id=" + taskToClone.sys_id);
}
}
}
// ACN added - copy reason for follow up to cloned task
function getWorkNote(clone) {
clone.work_notes = "Reason for incomplete closure of original task:\n" + work_notes_update;
clone.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 05:16 AM
Hello,
I have the same problem,
the manual changes made on the form before hitting the UI Action(which triggers UI page) are not saving to the database although we have the g_form.save() in the UI Page client script.
The processing script is working fine though.
were you able to resolve this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 05:27 AM
Hi,
Please go through below link.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0743833
Mark it correct and helpful.
Thanks
Bhagyashri Sorte.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 05:36 AM
Thank you for your reply,
I tried using all the 3, g_form.save(), g_form.submit() and gsftSubmit(null, g_form.getFormElement(), 'sysverb_update_and_stay') ,but still it does not update the values entered on the form after the processing script in the UI Page gets executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 12:44 AM
I had the same and resolved it with adding Write ACL on field State (which I'm changing in my client script) which allows to change the state for end user who clicks this button. So first make sure that this user can change the status manually on the form, if no - it's ACL issue and button will not work until you fix ACL.