Redirect service portal page one to another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 06:04 AM - edited 05-06-2024 06:06 AM
I have a requirement in service portal widget
Below is my client side code
api.controller = function($rootScope, $scope, $location) {
var c = this;
c.pageredirected = function() {
c.data.action = true;
c.server.update().then(function(response){
if (response.data.ans === true){
$location.search('id=data_test&eml=asda');
// alert('working');
}})
}
};
Here is my server side code
(function() {
if(input && input.action){
data.ans=true;
// gs.addInfoMessage('working')
}
})();
i have to execute my server side code data.ans= true
then it redirected to the page id which i have given
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 07:32 AM
Hi @dheeru_1994 ,
Please try the below script it is working perfect in my PDI.
api.controller = function($rootScope, $scope, $location) {
var c = this;
c.pageredirected = function() {
c.data.action = true;
c.server.update().then(function(response) {
if (response.data.ans === true) {
// Instead of modifying the URL query, perform a redirect
$location.url('/desired/path?id=data_test&eml=asda');
}
});
}
};
If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.
Regards,
Amitoj