Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need help on Redirecting to another page in Service portal

shaik_irfan
Tera Guru

Hi,

 

I have created a Registration Form where user enter the information and press Sign Up button, upon click it will create a record in u_registration table till now everything is working fine. 

Now once the user clicks the Sign up button i wanted to redirect to another page which is "user-assessment-page" and i wanted to display the current user entered information there

 

Once the user the submits i am getting the sys id of the created record how can i pass the sys id to User Registration widget under  "user-assessment-page"  page ?

Can anyone please help me how to do this ?

1 ACCEPTED SOLUTION

Hi Shaik,

Did you remove the action and method part from the form tag.

Update your client script with this :

Try with this script: (changes are added $window in the function parameter and use $window.open();

And check also whether alert is coming or not:

function($window) {
/* widget controller */
var c = this;

c.addPersonalDetails = function() {
if(!c.data.name || !c.data.phone || !c.data.email || !c.data.applyfor)
{
alert("All fields are Mandatory");
}
else{
alert("Success")
c.server.update().then(function(response){
alert('inside' + data.sysid);
$window.open("/sp?id=preliminary_evaluation&sysid="+data.sysid);
})
}
}

Added alert for testing purpose.

 

Thanks,

CB

View solution in original post

15 REPLIES 15

Hi Shaik,

It is because you have used <form action="/examples/actions/confirmation.php" method="post">

this part 

Instead of this :

use this : (Remove action part and method part).
<form >

 

 

Thanks,

CB

Sir,

 

Is there anything wrong in my script. 

It is still not taking me to the other page 😞

 

I see the record is getting created in the logs i can see the sys id but it is not working

 

function($location) {
/* widget controller */
var c = this;

c.addPersonalDetails = function() {
if(!c.data.name || !c.data.phone || !c.data.email || !c.data.applyfor)
{
alert("All fields are Mandatory");
}
else{
alert("Success")
c.server.update().then(function(response){
c.data = {};
// $location.search('id=preliminary_evaluation&sysid='+c.data.sysid);

window.location.href="/sp?id=preliminary_evaluation&sysid="+data.sysid;
})
}
}
}

Hi Shaik,

Did you remove the action and method part from the form tag.

Update your client script with this :

Try with this script: (changes are added $window in the function parameter and use $window.open();

And check also whether alert is coming or not:

function($window) {
/* widget controller */
var c = this;

c.addPersonalDetails = function() {
if(!c.data.name || !c.data.phone || !c.data.email || !c.data.applyfor)
{
alert("All fields are Mandatory");
}
else{
alert("Success")
c.server.update().then(function(response){
alert('inside' + data.sysid);
$window.open("/sp?id=preliminary_evaluation&sysid="+data.sysid);
})
}
}

Added alert for testing purpose.

 

Thanks,

CB

Yes i did remove the form action still it is not working

 

Can you please look into my instance if you dont mind ?

 

https://dev51617.service-now.com/sp_config?id=widget_editor&sys_id=a37b11912ff19010209857892799b6e3&...

 

 

admin

12345

Username and password invalid