Ui page redirection to current record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 07:41 AM
Hi Everyone,
I am facing issues on redirection to the current incident page from the ui page once submitted , cancelled .
I have written the below code in html and client script still after each button clickable it is redirecting to the ui page itself not the current incident page.
Can anyone please help me here ti resolve thies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 07:46 AM
Hi @svani
try below updated code:
HTML and Client Script
HTML (UI Page):
<td colspan="2" style="text-align:left;padding-top:10px;">
<button class="btn btn-primary" onclick="update_ticket()" style="margin-right:10px;">Link Jira</button>
<button class="btn btn-primary" onclick="continueOK()" style="margin-right:10px;">Create Jira</button>
<button class="btn btn-primary" onclick="continueCancel()">Cancel</button>
</td>
Client Script:
// Function for updating ticket or any action
function update_ticket() {
GlideDialogWindow.get().destroy(); // Close the dialog window if any
// Perform your action (update ticket, etc.)
// After completion, redirect to current incident page
var url = window.location.href; // Get current page URL
top.window.location.href = url; // Redirect to current incident page
}
// Function for continuing after creating Jira
function continueOK() {
GlideDialogWindow.get().destroy(); // Close the dialog window if any
// Perform your action (create Jira, etc.)
// After completion, redirect to current incident page
var url = window.location.href; // Get current page URL
top.window.location.href = url; // Redirect to current incident page
}
// Function for canceling action
function continueCancel() {
GlideDialogWindow.get().destroy(); // Close the dialog window if any
// Perform any cancelation action (if needed)
// Redirect to current incident page after canceling
var url = window.location.href; // Get current page URL
top.window.location.href = url; // Redirect to current incident page
}
This approach should help ensure that after performing an action on your UI page, the page redirects back to the current incident page in ServiceNow as intended. Adjust the actions performed in each function (update_ticket(), continueOK(), continueCancel()) based on your specific requirements and workflows.
———————————————————-
If my response helps, please mark it as "Accept as Solution" and consider it "helpful."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 08:10 AM
Hi @Satishkumar B ,
i think its the same what i have written already but changed no luck.facing same issue.
thanks,
Sreevani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 08:13 AM
HTML (UI Page):
<td colspan="2" style="text-align:left;padding-top:10px;">
<button class="btn btn-primary" onclick="updateTicket()">Link Jira</button>
<button class="btn btn-primary" onclick="createJira()">Create Jira</button>
<button class="btn btn-primary" onclick="cancelAction()">Cancel</button>
</td>
Client Script:
function updateTicket() {
GlideDialogWindow.get().destroy(); // Close any open dialog window
// Perform update ticket action (replace with actual logic)
// Redirect to current incident page
redirectToCurrentIncident();
}
function createJira() {
GlideDialogWindow.get().destroy(); // Close any open dialog window
// Perform create Jira action (replace with actual logic)
// Redirect to current incident page
redirectToCurrentIncident();
}
function cancelAction() {
GlideDialogWindow.get().destroy(); // Close any open dialog window
// Perform cancel action (replace with actual logic)
// Redirect to current incident page
redirectToCurrentIncident();
}
function redirectToCurrentIncident() {
var url = window.location.href; // Get current page URL
top.location.href = url; // Redirect to current incident page
}