The CreatorCon Call for Content is officially open! Get started here.

Populate variable dynamically servicenow

servicenow14710
Tera Expert

Hello developers, can you please help me on how to populate lookup select box/select box dynamically from the answer i get from script include .Any help is appreciated. Thanks!

7 REPLIES 7

Sainath N
Mega Sage

@servicenow14710 : Please refer to the article below. This can serve as a guide to start with. Its well articulated with the step-by-step instructions.

 

https://www.servicenow.com/community/developer-articles/how-to-call-script-include-from-client-scrip...

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Hello @Sainath N : Thanks for your response I am facing concern populating lookup select box/select box  i could response properly but need help on populating . Thanks !

@servicenow14710  Could you please post the code which you are trying. I will suggest the changes accordingly.

Hi @Sandeep Rajput : I used similar code , but it return sys id of table. I need to populate/override table columns with filter we get from glide record similar to how we give reference qualifier to table. Thanks!

var SampleUtils = Class.create();
SampleUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getSomeResponse: function(){
var tblGr = new GlideRecord('Table_name');
tblGr.addEncodedQuery('Some_Query');
tblGr.query();
var response = []; //An array to store all sys_ids from the query
while(tblGr._next()){
response.push(tblGr.getUniqueValue()); //Insert the sys_id into the array
}
return response.join(','); //Return the array as comma seperated string
},

type: 'SampleUtils'
});