- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:11 AM
Hi All,
I am stuck in middle, please help me to sort my issue,
for 1 problem if there are 5 incident records are related i want to get the first incident which is related to that problem and want to update some data in to that incident.
Let me know how to add the logic in the filter in business rule so i can get the first record only.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:26 AM
Hi,
at which place you are writing this script?
BR? if yes then on which table?
Actually there is no field which can help you determine which incident was first linked with the problem
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:14 AM
Hi Santoshi,
Use setLimit(1) before gr.query(); function and that should work.
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:16 AM
just adding setlimit will not get the exact incident number which is tagged first to that problem, it will give the 1 record not sure if that record is first tagged one or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:21 AM
Try like this.?
var rt = new GlideRecord('incident');
rt.addQuery('problem', current.sys_id);
rt.orderBy('created_on');
rt.setLimit(1);
rt.query();
while(rt.next())
{
rt.short_description = 'wrtie something';
rt.update();
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:26 AM
Hi,
at which place you are writing this script?
BR? if yes then on which table?
Actually there is no field which can help you determine which incident was first linked with the problem
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader