How to get current URL link in a variable.

Ilavarasu2
Tera Contributor

How to get current URL link in an variable? 

Requirement is from incident form through UI action url redirected to record producer which has to create change record.

Once change record created, Incident form has to be get updated with caused_by related reference field to change record.

Can you please help to get the URL link in an varaible that redirects to record producer.

 

Thank you

1 ACCEPTED SOLUTION

Hi,

you need to write onLoad catalog client script to get the url parameter value

Is the extra parameter in url with name as sys_id ?

if yes then try this

function onLoad(){

var url = top.location.href;
var value = new URLSearchParams(url).get("sys_id"); // give here the parameter name
g_form.setValue('hidden_variable', value);

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

9 REPLIES 9

Hello @Ankur Bawiskar ,

How can we fetch the same on mobile?

I have created a record producer and I'm redirecting to that record producer from mobile. I am passing sys_task_id parameter from mobile smart button and redirecting to record producer.

How to fetch "sys_task_id" parameter ??

Please help.

This one worked for me!  Thanks!

This is brilliant. Works like a charm!

Ilavarasu2
Tera Contributor

Thank you !! It works.

You are welcome

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader