RP.getParamterValue('sysparam_name') not working

Jag5
Tera Guru

Hi, 

I am trying to get the sys id from the url of kb_view UI page. But it is not working. Below is the script I am using and not sure where I am doing wrong. Any help is much appreciated. 

Here is the url of knowledge article: https://dev58373.service-now.com/kb_view.do?sys_kb_id=e97ee81eff6002009b20ffffffffffe0

<g:evaluate var="jvar_url" >

// Retrieve the record number passed in the URL Param 'sysparm_number'
var number = RP.getParameterValue('sys_kb_id');

gs.log('KB Number:' + number);

// Create a variable to hold our result
var answer;

// GlideRecord query to find the record
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('sys_id', number);
gr.query();
if(gr.next()){

// Found a record with the matching number
answer = gs.getProperty('glide.servlet.uri') + 'nav_to.do?uri=' + gr.sys_class_name + '.do?sys_id=' + gr.sys_id;
answer;
}else{
// Couldn't find a record with the matching number
answer = 0;
answer;
}
</g:evaluate>

Thank you,

Jag. 

5 REPLIES 5

Hi Saikiran,

The dialog window is a ui page (kb_view_suggest) which was triggering from UI script(kbviewarticle) and not from UI action. But I have also tried RP.getWindowProperties().get('sys_kb_id'); before and it did not work.

Thanks,

Jag.