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

Chuck Tomasi
Tera Patron

What does your final gs.log() report?



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

In Logs I am getting correct URL as expected based on logged in user.


Does your script include have the standard prototype construct similar to sample1 or did you put your code wrapped in a function in sample2?



// sample1


var myConditionCheck = Class.create();


myConditionCheck.prototype = {


      initialize: function() {


      },




      type: 'myConditionCheck'


};




//sample2


function myCode() {


        // my code here


}


It is like sample 2