How to call script include URL(argument) of link type

himabindu_b02
Kilo Contributor

PFB, screen shot. Coding I used in script Include. Here I am returning entire argument in script include as query parameter also populating dynamically based on logged in user. Please help me in resolving this. I am getting blank page.

find_real_file.png

Script Include :

var usr = gs.getUserID();

var terr;

var TTYPE;                                  

var clu;                                

var Reg;                                  

  var gr = new GlideRecord('sys_user');

  gr.addQuery('sys_id',usr);

  gr.query();

if(gr.next())

  {

    terr=gr.u_territory;

    clu=gr.u_cluster;          

    TTYPE = gr.u_location_type;  

    Reg = gr.u_region;

  }

gs.log("ALL CLU******"+clu);

    var url;

    if(TTYPE=="Territory"){

    url = '/incident_list.do?sysparm_query=opened_by.u_territory='+ terr;

//gs.setRedirect("/incident_list.do?sysparm_query=opened_by.u_territory="+terr);

    }

    else if(TTYPE=="Cluster"){

      url = '/incident_list.do?sysparm_query=opened_by.u_cluster='+ clu;

    // gs.setRedirect(url);

    }

    else if(TTYPE=="Region"){

  url = '/incident_list.do?sysparm_query=opened_by.u_region='+ Reg;

    // gs.setRedirect(url);

    }

gs.log("ALL URL******"+url);

return url;

Thanks,

Bindu.

9 REPLIES 9

Hello Bindu,



In arguments;



javascript: new Cluster().myCode()



call something like this and try.let me know.


Just a small correction on surya's function call. Missed semi colon


javascript: new Cluster().myCode();


calling script include and its function should be done as shown above. It should work if your code is correct.



Please hit like or correct if it helps you in anyway!


I have already tried that. It is working in script argument. But not in URL argument.


Can you have all the static values added in the module's arguments and check if it works fine?? and then match it with the returning url.


Just a suggestion!


OK, then your call is correct. You're just using a direct script include function. If the word "prototype" doesn't appear in the script include, you just call the function directly.



javascript:Cluster()



That being said, what do you get when you use Scripts - Background and type in



Cluster()



Faster Server Side Script Development and Test