Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

What is the replacement of DOM "document.URL.parseQuery() "?

Ashwini Jadhao
Giga Guru

HI,

Could you please tell me the replacement of "document.URL.parseQuery()" from the following script?

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@snowDEV 

you can use this

var url = top.location.href;

var comp = new URLSearchParams(url).get("sysparm_Id");

Regards
Ankur

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

View solution in original post

11 REPLIES 11

AnirudhKumar
Mega Sage
var gURL = new GlideURL();
	gURL.setFromCurrent();
	alert(gURL.getParam("sysparm_id"));

GlideURL isn't supported on portal

AnirudhKumar
Mega Sage

Hi Ashwini, did the code work?

Ankur Bawiskar
Tera Patron

@snowDEV 

you can use this

var url = top.location.href;

var comp = new URLSearchParams(url).get("sysparm_Id");

Regards
Ankur

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