
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 10:51 PM
I would like to have a portal announcement created when an outage is created. I don't really care if it is automatic or requires some other prompt, like if a checkbox is selected on the outage form then create an announcement for example.
I figure a business rule or an event might be the way to go, but I really have no idea how to start either as when I choose a table, I have no idea how to link to the other table - announcement or outage.
I'd also want the end date being added to the outage to auto de activate the announcement.
I've already found this previous question, but it is not at all helpful:
Creating Announcements from Outages
If you have an idea can you also please include some details - I won't know how to go further without at least a bit of a start.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 12:23 AM
Sorry My bad,
Create 2 BR,
For Update :-
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("announcement");
gr.addEncodedQuery("active=true^nameLIKE"+current.number);
gr.query();
if (gr.next()) {
gr.to=current.end;
gr.update();
}
})(current, previous);
For Insert :-
BR only after Insert
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("announcement");
gr.initialize();
gr.name = 'Outage Number' + current.number + ' created.';
gr.title = 'Outage For' + current.getDisplayValue('cmdb_ci') + ' is created.';
gr.summary = current.short_description;
gr.active = 'true';
gr.from = new GlideDateTime();
gr.insert();
})(current, previous);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 02:57 AM
@Gunjan Kiratkar thank you for your help, works beautifully.
Love your work, thanks again.