How can i split a url and take out the sys_id value and use in a variable.

arun124
Kilo Contributor

URL=ServiceNow

https://dev17964.service-now.com/incident.do?sys_id=d71da88ac0a801670061eabfe4b28f77&sysparm_view=&s...

I want to take the url of the current page and get the value of sys_id used in the url .

How to get the value of sys_id if I want to use it my script?

6 REPLIES 6

Alikutty A
Tera Sage

Hi Karun,



If you are using a client script then use g_form.getUniqueValue()



If you are using a business rule you can use current.sys_id  




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


@alikutty karupamveetil .No I think u miss undershoot me i know how to take out sys_id.


what my actual requirement is i want to take out sys_id but using url from the parameter not copy the record get sys_id or something.


Just get the url and take out the sys_id   parameter from the url.


Please try this and let me know, The code gets sys_id from URL



var url = document.URL.parseQuery();


if (url['sys_id']) {


  url = decodeURI(url['sys_id']);


}



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


okay i will try this.