- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 09:40 AM
Hi guys,
In my custom Customer table how can I get sys_id for each record?
var gr = new GlideRecord("x_11111_notes_customers");
gr.addActiveQuery();
gr.orderByDesc('sys_updated_on');
gr.query();
data.customers = [];
while(gr.next()){
var customer = {};
customer.id = gr.sys_id;
customer.name = gr.getDisplayValue('name');
data.customers.push(customer);
}
This code in line #10 returns nothing.
Where I am wrong?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 11:34 AM
No on service portal gr.getDisplayValue("sys_id"), it only works.
customer.id = gr.sys_id+'' and customer.id = gr.getValue('sys_id') all are not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 09:45 AM
Use this one, $sp.getParameter("sys_id")
Can i know what you are doing above I did not understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 09:53 AM
There is no code above. This is the full Server Script in my widget. The requirement is to get all records with sys_id and name from Customers table and pass the data to Client.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 10:08 AM
Hi Ivan,
Replace customer.id = gr.sys_id; with customer.id = gr.getValue('sys_id') or customer.id = gr.sys_id+'';
Hope this helps.
Regards,
Ujjawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017 11:30 AM
Hi Ivan,
Have you tried to replace customer.id = gr.sys_id; with customer.id = gr.sys_id+'';
As per my understanding this should also work.
Regards
Ujjawal