In this blog, we are discussing about one more real-time scenario: how to automatically create an announcement on the service portal if any P1 incident is created.
Scenario: Create an announcement automatically on service portal when P1 incident is created in the application development group.
Steps:
1. Go to Business rule, put details like below image.
2. Code :
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("announcement");
gr.initialize();
gr.name = "P1 Announcement";
gr.title = "We having outage at this moment";
gr.summary = current.short_description;
var announcement_id = gr.insert();
var mapping = new GlideRecord('m2m_announcement_portal');
mapping.announcement = announcement_id;
mapping.sp_portal = '81b75d3147032100ba13a5554ee4902b';
mapping.insert();
})(current, previous);
3. Test by creating P1 Incident.
No comments:
Post a Comment