- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 04:06 AM
Hello!
The objective of my script below is to get the Description field of the SCTASK from the RITM table. If there are more than one SCTASK for the RITM, it would get the value of the ITEM field.
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.query();
var count = gr.getRowCount();
var desc;
if (count == '1')
desc = gr.description;
else
desc = current.cat_item;
Please help!
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 04:41 AM
I was able to make this work with this script:
var count = 0;
var desc;
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.query();
while (gr.next()) {
count = count + 1;
}
if (count == 1) {
desc = gr.description;
}
else {
desc = current.cat_item.getDisplayValue();
}
May I also know why getRowCount is not recommended?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 04:30 AM
Hi,
please give an overview on where this script is written on which BR?
What exactly is required?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader