Write a code for server script for fetching a custom table value ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 11:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 11:50 PM
Hi @1dusjhyahnt ,
Do you want this to happen on Catalog Item form? As per the screenshot believe that is what u require. If yes then You can use Auto populate feature of ServiceNow where while creating any variable there is a tab for autopopulate where u can specify the field names & table from where it should auto populate . It will provide u the result. No coding required for this.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2024 12:01 AM
USER requirement is that he want a editable table in portal when he update the value then automatically updation occur in artificatory table ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 11:53 PM
Hello @1dusjhyahnt
Can you try like below :
Have done for demo on incident table -
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
/*1. Declare the array*/
var myArray =[];
/*2. Glide record on table*/
var grInc = new GlideRecord('incident');
grInc.addQuery('sys_id','45b29e1b3b101300088d832b44efc492');
grInc.query();
if(grInc.next()){
/*2.1 Create empty object*/
var myObject = {
};
/*2.2 Set object values*/
myObject.number = grInc.getValue('number');
myObject.state = grInc.getValue('state');
/*2.3 Push object in array*/
myArray.push(myObject);
}
/*3. Set array to data */
data.values = myArray;
gs.addInfoMessage(data.values[0].number);
gs.addInfoMessage(data.values[0].state);
})();
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2024 12:11 AM
hii @Vishal Birajdar