Redirect to Task table not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2024 05:25 AM
We have two table: Request and Task Form. I used a UI action to show a modal for copying a record. Then, on the UI page, I copied the existing request to a new request. After meeting the condition, the task is created. On the task, after clicking 'OK' on the modal, it should redirect back to the task of the newly created request. However, this is not happening. I attached a screenshot where it is redirecting instead of the Task form.
Client Script: UI Page
function submitCancel(){
GlideDialogWindow.get().destroy();
return false;
}
function submitChanges() {
GlideAjax.disableSessionMessages();
return true;
}
Processing Script: UI Page
processCopyRecord();
function processCopyRecord() {
var copyRecordSysID = '';
var grSourceRecord = new GlideRecordSecure(table);
if (grSourceRecord.get(recSysID)) {
var getSourceTable = grSourceRecord.getTableName();
var grCopyRecord = new GlideRecordSecure('request');
grCopyRecord.sys_created_by = grSourceRecord.sys_created_by;
....
grCopyRecord.accomodation = task_requested_accomodation;
copyRecordSysID = grCopyRecord.insert();
var gr = new GlideRecord('task');
if (gr.get('parent', copyRecordSysID)) {
var sysid = gr.sys_id;
}
response.sendRedirect('task.do?sys_id=' + sysid); //original
}
}
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2024 07:06 AM
Check if your sendRedirect call works if you temporarily remove all other code from the processCopyRecord function.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/