- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:00 AM
Hello,
I am making Business Rule that checks incident number and gets it's sys id.
Problem is how can i make a script that checks my display value for example "INCE0012345" as a query?
var inc = new GlideRecord('incident'); query that queries the display value and return sys id of this ince0012345 | |
inc.addQuery("sys_id", 'this is ince0012345 sys id'); | |
inc.query(); |
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:30 AM
To display the sys_id you need to do:
var gr = new GlideRecord('incident');
gr.addQuery('number', 'INCE0014635');
gr.query();
while(gr.next()){
gs.print(gr.sys_id);
}
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:27 AM
hi,
i want to grab sys id of the record that I know number like this:
var gr = new GlideRecord('incident');
gr.addQuery('number', 'INCE0014635');
gr.query();
gs.print(gr.getRowCount());
gs.print(gr.sys_id);
it displays that Row count was 1 and sys_id was empty. Cant figure out whats the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:30 AM
To display the sys_id you need to do:
var gr = new GlideRecord('incident');
gr.addQuery('number', 'INCE0014635');
gr.query();
while(gr.next()){
gs.print(gr.sys_id);
}
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:35 AM
thank you very much! I got it working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:37 AM
Glad I could help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 02:33 AM
You are missing while(gr.next());