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

RaghavSh
Kilo Patron

on the click function in client controller use:

 

window.location.href="/sp?id=user-assessment-page&sys_id="+data.sys;

 

if you are getting the sys_id in server side, you can store that in data like data.sys='sys_id'; and use that in client controller.


Raghav
MVP 2023

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

If you are passing the sys_id in some parameter like abc then you can fetch that in server side script of widget as below

var sysId = $sp.getParameter("abc");

So if the url is

window.location.href="/sp?id=user-assessment-page&abc="+data.sys;

then var sysId = $sp.getParameter("abc"); will work.

 

This should be done in user registration widget.


Thanks,
Ashutosh

Chander Bhusha1
Tera Guru

HI Shaik,

Once you send the input from the client side to server side and there you will create a record. You have to store the sysid in the data object as :

In server side:

data.sys_id = '';//New record sysid

 

Client controller:

You have to use the url after inside this function (c.server.update() like this :

c.server.update().then(function(response){

window.location.href="/sp?id=user-assessment-page&sysid="+data.sys_id;

})

 

 

Mark helpful and correct if it helps.

Thanks,

CB

shaik_irfan
Tera Guru

I tried but it is not redirecting.

 

In my HTML there is something like as shown below:

 

<div class="signup-form">
<form action="/examples/actions/confirmation.php" method="post">

 

When i click the button it is navigating to above url 😞

 

https://devXXXXX.service-now.com/examples/actions/confirmation.php

 

If i remove that form action line entire look up field of the page is getting disturbed 😞