How to get current catalog item sys id in script include which should be run on service portal?

manishaidhate
Mega Expert

We have to get sys id of catlog item (current).

As per below code we have used getParameter() function, which is running fine on service now view, but not running for Service portal.

Any one knows alternative to get current sys id of catalog item in script include ?

Script include

var ApplicationModule = Class.create();

ApplicationModule.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getCatItemAppMod: function () {

var cat_sys_id = this.getParameter('sysparm_cat_sys_id');

var gr = new GlideRecord('sc_cat_item');

//gr.addQuery('sys_id','b69a135f13967e00be19bda12244b0e7');

    gr.addQuery('sys_id',cat_sys_id);

gr.query();

if (gr.next()) {

return "u_application=" + gr.u_application_name + "^u_module=" + gr.u_default_module;

}

return 'Yes to check';

},