Unable to fetch the current URL in the UI ACTION

dheeraaj
Giga Expert

Hi All,

I have a UI Action, which I am using as a List Context menu and List Choice. 

I am calling a UI Page from this UI Action. I want to send this current URL as a parameter, but unable to senmd so.

I tried using alert ,but the UI Action itself is not working. 

can someone  help me in resolving this issue ? See the below code:

function LinkFP() {
var url = window.parent.location.href;

alert(url) ---------> Not working
//collection paramater to pass to the UI Page
var listID = g_list.listID; //table name
var rec_list = g_list.getChecked().toString();//sysid of the item checked.
var rec_query = g_list.getQuery(false, false, true); //query that currenty on the form
var list_count = g_list.getRowCount(); //count of all the records based on the query filter
var o_dynamic = rec_query.indexOf("DYNAMIC");

if(o_dynamic <0){
//call the glidemodal UI Page
var url = GlideURLBuilder.newGlideUrl("sn_si_FalsePositiveRequest.do");
url.addParam('selected_list_count', list_count);
url.addParam('selected_rec_list', rec_list);
url.addParam('selected_rec_query', rec_query);
url.addParam('selected_instance', url);
url.addParam("sysparm_nostack", "no");

 

Regards,

Dheeraaj

1 ACCEPTED SOLUTION

dheeraaj
Giga Expert

I was able to figure out this myself.

Thanks all.

For anyone looking to implement the same thing, I am pasting the code below: 

var glide_url = new GlideURL();
glide_url.setFromCurrent();
var target = glide_url.getParam("sysparm_query");

 

Regards,

Dheeraaj

View solution in original post

4 REPLIES 4

Elijah Aromola
Mega Sage

You can try using gURL:

var gUrl = new GlideURL();
gUrl.setFromCurrent();
alert(gUrl)

Hi,

 

I used the above script and it is alerting gUrl ?

Is there any script missing ?

 

Regards,

Dheeraaj

I mean its not alerting the value, its alerting the word "gUrl"

 

Is there any script that that I am missing ?

 

Regards,

Dheeraaj

dheeraaj
Giga Expert

I was able to figure out this myself.

Thanks all.

For anyone looking to implement the same thing, I am pasting the code below: 

var glide_url = new GlideURL();
glide_url.setFromCurrent();
var target = glide_url.getParam("sysparm_query");

 

Regards,

Dheeraaj