Use Case: Whenever a new Sev 1 or Sev 2 case is created and assigned to TEST-CORE-UNIX, TEST-CORE-INTEL We have to get notified on slack channel #test-core-client-internal with below message
Example - Ticket number - Customer - Short Description - This “Severity” ticket is in queue, requires an owner
To Achieve this we are going to create a Business Rule
Name: Case notification for SQ_Core Groups
Table: Case
var slackLinkByGroup = {};
//Slack-Group Mapping
slackLinkByGroup['TEST-CORE-SERVICES-INTERNAL'] = "https://hooks.slack.com/services/Tiiiijjjhhh/yBMNpZCkjhgfdsa";
slackLinkByGroup['TEST-CORE-CLIENT-INTERNAL'] = "https://hooks.slack.com/services/TS7lklhgffds/slqdioiuytredf883";
var coreServiceGroups = ["TEST-CORE-DATABASE", "TEST-CORE-Backup"];
var coreClientGroups = ["TEST-CORE-UNIX", "TEST-CORE-INTEL"];
var allowedInstances = ["https://dev567.service-now.com/"];
var instanceURL = gs.getProperty('glide.servlet.uri');
(function executeRule(current, previous /*null when async*/ ) {
    if (this.isAllowedInstance()) {
        var isPlainTextRequired = false;
        var emoji = "mega";
        var colorCode = "#36a64f";
        var headingText = "This Severity " + current.priority + " is in queue and requires an owner";
        var ticketNumber = current.number;
        var customer = current.account.getDisplayValue();
        var shortDescription = current.short_description;
        var incidentLink = instanceURL + "sn_customerservice_case.do?sys_id=" + current.sys_id;
        var fallBackText = ticketNumber + "-" + customer + "-" + shortDescription + "-" + headingText;
        var plainTextMessage = "{\"text\": \"" + fallBackText + "\"}";
        var slacklink = this.evaluateSlackLink(current.assignment_group.getDisplayValue());
        var assignmentGroup = current.assignment_group.getDisplayValue();
        var template = "{ \"attachments\":[";
        template = template + "{\"fallback\": \"%fallBackText%\",";
        template = template + "\"color\": \"%colorCode%\",";
        template = template + "\"fields\": [";
        template = template + "{\"title\": \":%emoji%: %headingText%\", \"short\": false },";
        template = template + "{\"value\": \"Ticket number : `%ticketNumber%`\", \"short\": false },";
        template = template + "{\"value\": \"Customer : `%customer%`\", \"short\": false },";
        template = template + "{\"value\": \"Assignment Group : `%assignmentGroup%`\", \"short\": false },";
        template = template + "{\"value\": \"Short Description: `%shortDescription%`\", \"short\": false },";
        template = template + "{\"value\": \"_Click here to view it_ : <%incidentLink%|*incident*>\",\"short\": false }";
        template = template + "]}";
        template = template + "]}";
        template = template.replace("%fallBackText%", fallBackText);
        template = template.replace("%colorCode%", colorCode);
        template = template.replace("%headingText%", headingText);
        template = template.replace("%ticketNumber%", ticketNumber);
        template = template.replace("%customer%", customer);
        template = template.replace("%assignmentGroup%", assignmentGroup);
        template = template.replace("%shortDescription%", shortDescription);
        template = template.replace("%incidentLink%", incidentLink);
        template = template.replace("%emoji%", emoji);
        var finalMessage = isPlainTextRequired ? plainTextMessage : template;
        try {
            var request = new sn_ws.RESTMessageV2();
            request.setHttpMethod('post');
            request.setRequestBody(finalMessage);
            request.setEndpoint(slacklink);
            var response = request.execute();
        } catch (ex) {
            //Nothing to do
        }
    }
	current.update();
})(current, previous);
function evaluateSlackLink(groupName) {
    if (coreServiceGroups.indexOf(groupName) !== -1) {
        return slackLinkByGroup['TEST-CORE-SERVICES-INTERNAL'];
    }
    if (coreClientGroups.indexOf(groupName) !== -1) {
        return slackLinkByGroup['TEST-CORE-CLIENT-INTERNAL'];
    }
}
function isAllowedInstance() {
    return allowedInstances.indexOf(instanceURL) !== -1;
}- Understanding Request, RITM, Task in ServiceNow
- Steps to create a case in ServiceNow (CSM)
- Performance Analytics in 10 mins
- Event Management in 10 minutes - part1
- Event Management in 10 minutes - part2
- Custom Lookup List
- Script includes in 5 minutes
- Interactive Filter in 5 minutes
- UI Policy in 6 Minutes
- Client Side Script Versus Server Side Script in 3 minutes
- 
                                Snow
                                - Performance Analytics
- ServiceNow Scripts
- Script include
- Useful scripts
- Basic Glide Scripts
- Client Script
- Advance Glide Script
- Glide System Script
- Admin
- Import Set
- Work Flow
- ACL
- SLA
- Notification
- Core Application
- UI Policy
- UI Action
- Client Script
- CAB Workbech
- Data Policy
- Connect Support
- Catalog
- Discovery
- CSM
- Event Management
- HR
- Integrations
- SSO Integration
- LDAP Integration
- SCCM Integration
- AWS Intergration
- Slack Integration
- CTI Integration
- Jira Integration
- Ebonding ServiceNow
- SOAP Integration
- IBM Netcool Integration
- VIP Mobile App Integration
- Rest Integration
- Service Portal
- Questions
 
- ACL
- Performance analytics(PA) Interactive Filter
- Various Configurations in Performance analytics(PA)
- Service Portal
- Performance Analytics(PA) Widgets
- Performance Analytics(PA) Indicator
- Performance Analytics(PA) Buckets
- Performance Analytics(PA) Automated Breakdown
- Client Script
- Rest Integration
- Understanding the Request, RITM, Task
- Service Catalogs
- Events in ServiceNow
- Advance glide script in ServiceNow
- CAB Workbench
 
   
        
Comments