- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2024 08:04 AM
I'm working on updating the "Update" button functionality. Upon making changes to a record (lets say a Business rule), we first check if the record belongs to a specific table. If it does, upon clicking "Update", we show a prompt to use that this is not a risky file, so don't update it. But if the user clicks "Proceed", we go ahead, save the record, and redirect the page to the previous one.
Now, after updating the UI functionality and implementing the logic, I am able to perform save. Example:
function proceedWithUpdateFromForm() {
g_form.save();
if (dlg != null) {
dlg.destroy();
}
}
function proceedWithUpdateFromForm() {
g_form.save();
if (dlg != null) {
dlg.destroy();
}
if (returnUrl != 'null') {
window.location.href = window.location.protocol + '//' + window.location.host + '/' + returnURL;
} else {
window.location.href = window.location.protocol + '//' + window.location.host + '/' + tblName + '_list.do?sysparm_userpref_module=' + module + '&sysparm_query=' + listQuery + '&sysparm_cancelable=true';
}
}
I'm attaching the sys_ui_action file, script_include and sys_ui_page relevant for the code.
Kindly advice.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 08:25 AM
Using g_form.submit and most importantly, creating a new sys_ui_action with table name="sys_metadata" and doing n an "override" onto the main sys_ui_action for Update worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2024 08:09 AM - edited ‎03-25-2024 08:09 AM
Hello @nikhilgupta2 ,
use action.setReturnURL(current); method in your script.
I hope this will resolve your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2024 08:28 AM
Since sys_ui_action is a client side script (as I enabled "client"), "current" is not valid there, as "current" is used in server-side scripts. Please correct me if I'm wrong. And that why the following code lines, including action.setReturnURL(current) won't get executed.
current.update();
var url = new sn_sow_inc.SOWIncidentUtils().getNewIncidentTaskLink(current);
action.setRedirectURL(url);
action.setReturnURL(current);
Please advice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2024 10:52 AM
Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2024 08:25 AM
Using g_form.submit and most importantly, creating a new sys_ui_action with table name="sys_metadata" and doing n an "override" onto the main sys_ui_action for Update worked.