How to redirect url from Widget after submit to Service Portal

Ajay Singh2
Tera Contributor

Hello 

 

I need redirect solution after submit form and it will redirect to sp portal from widget.

 

 

Thank You!!

1 REPLY 1

Runjay Patel
Giga Sage

Hi @Ajay Singh2 ,

 

you can use below code in your widget 

// This is part of the Client Script of the widget
function submitForm() {
var form = $scope.data.form;

// Submit the form or perform necessary actions here
form.submit().then(function(response) {
// After successful form submission, redirect to the Service Portal page
var redirectUrl = '/sp?id=your_target_page'; // Replace with your desired SP page URL
window.location.href = redirectUrl; // This will redirect the user
}).catch(function(error) {
// Handle any errors if needed
console.error('Form submission failed:', error);
});
}

 

Accept and like the solution if it helped.