- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2023 10:21 PM
Hi All,
We have the following requirement
- Cancel Button should prompt a Confirm Window (client-code)
- If Cancel Button is clicked, mandatory field check shall be skipped
I've return below code in UI action, but the problem is, that it seems like you can not combine sysverb_cancel with a client & server-side UI Action. This is what I observed:
- Confirm dialog pops up correctly.
- No error about missing mandatory fields is displayed
- But the server side code is not triggered, it is not moving the record to cancelled state.
Code :
function cancelTask() {
var confirmBox = confirm('Are you sure to proceed with cancelling the task?');
if (confirmBox) {
gsftSubmit(null, g_form.getFormElement(), 'sysverb_cancel'); //MUST call the 'Action name' set in this UI Action
} else {
return;
}
}
if (typeof window == 'undefined') {
cancel();
}
function cancel() {
current.status = 'cancelled';
current.update();
action.setRedirectURL(current);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2023 11:24 PM
@Ratan B You can achieve this requirement without using server side code also. Put below client side code in script section.
This I have tested for incident record and working fine. Put your "cancelled " state value in below statement. For incident record cancelled status value is 8.
g_form.setValue("state", "8");
function cancelTask() {
var confirmBox = confirm('Are you sure to proceed with cancelling the task?');
if (confirmBox) {
var arr = g_form.getMissingFields();
for (var x = 0; x < arr.length; x++) {
g_form.setMandatory(arr[x], false);
}
g_form.setValue("state", "8"); //check the cancelled status value and put it here.
g_form.save();
} else {
return;
}
}
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2023 11:09 PM
@Ratan B If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-18-2023 06:56 AM
@Ratan B Have you tried my solution ? If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-20-2023 04:42 AM
@Ratan B Have you tried my solution ? If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct !!