The CreatorCon Call for Content is officially open! Get started here.

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
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  ||  ✨ 9x 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
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  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader