problem = Invalid assignment left-hand side

kasalashiva
Kilo Contributor

rec_url = "https://"+ gs.getProperty('instance_name')   +".service-now.com/gbp/service_request.do?sysparm_id=+ current.syssparm_id," +sysparm_itype=sc_cat_item;

4 REPLIES 4

Chuck Tomasi
Tera Patron

Hi Shiva,



A couple things. First, when constructing a URL for the same instance, you can forget all the https://instance_name.service-now.com part. It's not needed. Building relative links will suffice, so start with:



var rec_url = '/gbp/service_request.do?sysparm_id=' + current.sysparm_id + 'sysparm_itype=' + sc_cat_item;



I'm making a lot of assumptions here about what you are trying to do and where data is stored. The end result is that you need to create the concatenated strings and variables with plus signs. I'm not seeing that in your statement. It looks a bit of a combination of plus and comma.


Thanks for Quick response..



Actually iam trying to navigate End user requested RITM page in RITM hyperlink number (notification).



Here is the link --



Here is the whole code please suggest



var url = getURL();


function getURL(){


  var SYSID ;


  var gr1 = new GlideRecord("sc_req_item");


  gr1.addQuery("request", current.sys_id);


  gr1.query();


  if(gr1.next()){


  SYSID = gr1.sys_id ;


  }


  var rec_url = '';


  var res_dom = getRecordDomain(current);


  if(res_dom==true)


  {


  rec_url = "https://"+ gs.getProperty('instance_name')   +".service-now.com/nav_to.do?uri=sc_req_item.do%3Fsys_id=" + SYSID; //For ITIL user working fine


  }


  else


  {


  rec_url = "https://"+ gs.getProperty('instance_name')   +".service-now.com/gbp/service_request.do?sysparm_id=+ current.syssparm_id," +"sysparm_itype=sc_cat_item,";//For End user not working (Actual link URL --Employee Self-Service Portal - Service-now.com )


  }


  return rec_url;


}


var gr = new GlideRecord("sc_req_item");


gr.addQuery("request", current.sys_id);


gr.query();


while(gr.next()) {


  template.print('<a href='+url+'> ' +gr.number+' </a>'+": "+gr.cat_item.getDisplayValue() + "\n");



}


Hi Shiva,



You can try the same URL for end users and additionally redirect them to ess view.



rec_url = "https://"+ gs.getProperty('instance_name')   +".service-now.com/nav_to.do?uri=sc_req_item.do%3Fsys_id=" +SYSID+ "%26sysparm_view=ess";



Please try and let me know.



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Again, you don't need the full URL (including the fully qualified domain name) - even in notifications. Outbound notifications can be created with relative URLs and the email system is smart enough to grab them and rewrite them for the current instance before sending. That's been a feature since Eureak (if my memory serves me correctly.)