Close dialog and return to page from where the dialog was initiated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-13-2019 05:54 AM
When submitting a dialog I want to redirect to the page, where I opened the dialog. I have previously tried this
var urlOnStack = gs.getSession().getUrlOnStack();
response.sendRedirect(urlOnStack);
Code is written in processing script.
The code brings me to the list, from where i opened the page form where I called the dialog.
Dialog is called from UI action.
I tried to use action.setRedirectURL(current) inthe UI action, but it does not succeed everytime.
- Labels:
-
Scoped App Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-13-2019 07:16 AM
Hello,
Try with the following:
var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
Let me know if it works.
Regards,
Paul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-15-2019 04:36 AM
It is not working. the script stops on the first line with this warning in system log.
org.mozilla.javascript.EcmaError: Cannot convert null to an object.
Caused by error in Phase 2 Jelly: plugin://com.glide.ui.form_presence/ui.jtemplates/doctype/activity_template_stream.xml.2 at line 3
1: var preferredInput = gs.getUser().getPreference('glide.ui.sn_hr_core_economy.stream_input');
2: if (jelly.jvar_stream_data && !jelly.jvar_stream_data.isAvailableField(preferredInput)) {
==> 3: preferredInput = jelly.jvar_stream_data.first_writable_journal().name();
4: }
5:
6: preferredInput;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-16-2019 12:17 AM
From what I can tell the error is not related to the redirect or the processing script, would it be possible to share the code / screenshots for the UI page you are calling or at least for the processing script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-19-2019 07:23 AM
Hi Paul
Thank you for replying on this request.
You are right about warning in system log does not come from the code "var urlOnstack = GlideSession().getStack().bottom()." This line of code simply just stopped script execution. I do not know why.
Furthermore I have been told that you cannot rely on "gs.getSession().getUrlOnStack();"
Problem solved using this line of code
var urlOnStack = 'sn_hr_core_case' + '.do?sys_id=' + order_sys_id;