
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2018 03:44 AM
Hi,
I have set up an integration between Service Now and Slack for sending notifications to slack whenever there is a request created in Service Now, i'm successful in sending the notifications, but can't decorate the notifications message using HTML tags, for example in the below 'text' i would like to make the 'Short description', 'Product Name' and 'Inquiry Type' as a bold texts and many other things.
Passing <b> </b> is not helping.
Any idea pls?
Script part:
var slack = new SlackMessageCC();
slack.payload.text = 'A new request has been assigned to ' + current.assignment_group.name + '. Please follow the link for more information.';
slack.payload.icon_emoji = ':exclamation:';
slack.payload.attachments.push({
'title': current.number.toString(),
'title_link': 'https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=sc_request.do?sys_id=' + current.sys_id,
'text':"<b>Short Description : <\/b>"+current.short_description.toString()+"\nProduct Type : "+current.u_product_name+" Inquiry Type : "+current.u_inquiry_type+" Location : "+current.location.name
});
slack.send();
Current Output what i'm getting is
Thanks
Yogesh Dafedar
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 04:11 PM
This should work
'text':"*Short Description* : "+current.short_description.toString()+"\n*Product Type* : "+current.u_product_name+" *Inquiry Type* : "+current.u_inquiry_type+" *Location* : "+current.location.name
Below are few slack tips
22 Handy Slack Hacks Everyone Should Know
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2018 05:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2018 03:29 PM
You will need to translate your HTML in to the Slack formatting.
https://api.slack.com/docs/message-formatting#message_formatting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2018 08:37 AM
Thanks Chuck, that helped

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2018 02:52 PM
Slight modification to observe best practices. Rather than dot-walking to location.name, use getDisplayValue(). Also, when possible, use getValue('field_name') to get the value, not a copy of the object. The more you use them, the fewer problems you will find.
'text':"*Short Description* : "+current.getValue('short_description') + "\n*Product Type* : " + current.getValue('u_product_name') + " *Inquiry Type* : " + current.getValue('u_inquiry_type') + " *Location* : " + current.location.getDisplayValue();