Using script include while constructing query in URL(from arguments ) in navigation link

adarshshivaprak
Kilo Contributor

Hello All ,

We had a requirement to show all open incidents which are tagged to the logged in   user. The entitlement is done on the user table.

Can we use script include while constructing URL (from arguments) along with fixed query to show the incidents returned by script include .

EG :

1.     incident_list.do?sysparm_fixed_query=caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe^active=true

Including script include :

2.     incident_list.do?sysparm_fixed_query=caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe^active=true&javascript:new INC_Selection().getincident().

Only the first query is working and the second is not working .

Any suggestion on how we can achieve it .

Thanks ,

Adarsh S

11 REPLIES 11

Chuck Tomasi
Tera Patron

Hi Adarsh,



I would have to see more of the code to understand, but my first reaction is that you don't need to include a javascript: in your JavaScript code, just run that code and concatenate the results.



Something like this



var incString = new INC_Selection().getIncident();


return 'incident_list.do?sysparm_fixed_query=caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe^active=true&' + incString;



That also lets you check the value of incString before you use it (in case it's empty)


adarshshivaprak
Kilo Contributor

Hi Chuck ,



I am writing the constructed query in the 'Arguments' field which appears when we are providing link from navigation menu. I am not sure   we can use scripts inside that field.




Thanks ,


Adarsh S


Sure you can.



find_real_file.png


adarshshivaprak
Kilo Contributor

We can use javascript function directly but we need to call script include and execute the script and should display back the results over there along with the query .