Create Incident from a custom Table Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 10:01 PM
Hi Guys,
Happy New Year.
Hope someone can shine some light or guide me in right direction. I have custom table with expiry date value field. What i wanted do was create incident 5 days before expiry date value from a record in a custom table and would like to have field values from that record in custom table as comments on the incident record. I have tried business rules with no luck so far.
Is that possible?
Thanks in advance.
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 10:19 PM
Hi there,
Can you share what you tried and did not work?
Anyway, reading your question, have you considered a Scheduled Flow for this? Zero code involved with what you are asking.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 10:46 PM
Hi Mark,
Scheduled Flow is that module under any app or was it called Scheduled workflow?
I did BR on the custom table with condition to trigger 5 days before expiry date and script to create incident.
Under When to run
When=before
Insert and update ticked
Thanks
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 11:18 PM
Just a Flow, and the trigger condition would be daily or whatever, so Scheduled Flow 🙂
And again, zero code involved.
You probably will get responses here also like Scheduled Job, scripting, etc.. Though why? Just a simple task which you can achieve with a Flow with for example a daily Trigger Condition.
If you have some experience with Flow Designer, this is likely a 5 minute job to achieve. If you haven't used Flow Designer before, it might cost you an hour though good learning experience which will pay off.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 11:14 PM
Hi Sandeep,
Try to create a schedule job which runs daily. Query your custom table for ex sample as table and u_date as field to be consider.
var gr = new GlideRecord('sample');
gr.addEncodedeQuery('u_date!='');
gr.query();
while(gr.next())
{
var nowDate = gs.nowDateTime();
var dt = gr.u_date;
var gdt1 = GlideDateTime(dt);
var duration1 = gs.dateDiff(gdt1, nowDate, false); // Date needs to be in system format.
var dur = duration.split(' ');
if(parseInt(dur[0]) == 5)
{
var incident = new GlideRecord();
incident.initialize();
incident.comment = 'Created from cutom table Sample'+'\n'+'Date:'+gr.u_date;
incident.insert();
}
}
Please update table and fields as per your requirement.
If this helps you. Please mark the answer as correct.
Thanks,
Vinu