Record Producer - Redirect to External URL Without "Leave Site Without Saving" Browser Prompt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I'm facing an issue with a Record Producer in HRSD and would appreciate any suggestions.
Requirement
I have a Record Producer with two variables:
- q1_help_area
- q2_details
One of the choices in q1_help_area is Workday.
When a user selects Workday:
- The q2_details variable is hidden.
- A message/alert should inform the user that this request must be submitted through Workday.
- The user should then be redirected automatically to the Workday URL without clicking the Submit button or any other button.
Current Implementation
I'm using an onChange Client Script on q1_help_area.
The script successfully:
- Detects the Workday selection.
- Hides the q2_details variable.
- Displays the alert/message.
- Attempts to redirect using window.location.href.
Problem
Because the Record Producer form has been modified, the browser/ServiceNow displays the standard warning:
"Do you want to leave this site? Changes you made may not be saved."
The user must click Leave before the redirect occurs.
This creates a poor user experience because the requirement is for the redirect to happen automatically without any additional confirmation.
What I've Tried
- window.location.href
- window.open()
- top.location.href
- Delayed redirect using setTimeout()
If I somehow prevent the "Leave site" warning, the redirect itself no longer occurs. The redirect only happens after the user manually clicks Leave.
My Questions
- Is there any supported way in ServiceNow to redirect a user from a Record Producer to an external URL without triggering the "Leave site without saving" prompt?
- Is this behavior controlled by the browser rather than ServiceNow?
- Is there an OOB property, API, or supported approach to achieve this seamless redirect?
- Has anyone implemented a similar Workday redirection from a Record Producer?
Any guidance or best practices would be greatly appreciated.
Thank you!
- Labels:
-
Human Resources Service Delivery