Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to customize MS Teams Notification

DASAMANDAMS
Tera Contributor

In  MS Teams Actionable Notifications, I need to include Catalog Item variables along with a few additional fields. Can someone please assist me on this?

 

2 REPLIES 2

prerna_sh
Kilo Patron

Hi @DASAMANDAMS ,

There is a "Provider Notifications", Checkout there is OOB notification on the approval table, just mark it inactive and create a new with the content whatever you want. Please check out the below articles for better understanding:
ServiceNow Provider Notifications: Configuring One... - ServiceNow Community
Provider Notifications || Notify users in Microsof... - ServiceNow Community
https://youtu.be/fqc863Amq68?si=Ucj-cacNwK7nANrY

Please Let me know anything else, or any other step you want😊
-------------------------------------------------------------------------------------------------------------------------------------------
If my response solves your query, please mark it helpful by selecting accept as Solution and Helpful. Let me know if anything else is required.
Thanks,
Prerna

This video demonstrates configuration for custom actionable notifications for Virtual Agent in ServiceNow. Resolve your tickets directly from Microsoft Teams chat.

sachinvic
Kilo Guru

@DASAMANDAMS 

Yes, this can be customized. The Teams approval notification is not limited to the two fields shown in the OOTB card.

For approval notifications, ServiceNow provides the sn_now_teams.ApprovalsVAUtil Script Include specifically for customizing the fields displayed in the approval notification. The OOTB implementation is in ApprovalsVAUtilSNC, and the custom ApprovalsVAUtil is used to override the fields returned by the OOTB implementation.

For example, if the approval is for a Requested Item, you can add the required RITM fields through the corresponding method:

getScReqItemFields: function() {

    return {

        "fields": [

            "sysapproval.number",

            "sysapproval.short_description",

            "sysapproval.requested_for",

            "sysapproval.opened_by",

            "sysapproval.description",

            "state"

        ]

    };

},

The exact method depends on the table referenced by the approval record. ServiceNow follows the get<TableName>Fields() naming convention, and for task-based approval records you can dot-walk through sysapproval. 

For Catalog Item variables, there is one additional consideration: catalog variables are not normal fields on the RITM table, so they cannot simply be added to the fields array in the same way as short_description, requested_for, etc.

If you need to display values such as:

  • Application Name
  • Subscription Type
  • Business Justification
  • Start Date
  • Any other Catalog Item variable

I would recommend exposing the required values through a proper server-side data point (for example, a custom field populated from the catalog variables) and then include that field in the approval notification customization.

This keeps the Teams notification customization separate from the OOTB approval processing and avoids modifying the OOTB Teams notification logic.

You can find the relevant ServiceNow documentation here:

Customizing approval notification fields:
ServiceNow – Customizing approval notification fields

Configure message content:
ServiceNow – Configure message content

One other option, if the requirement is to have complete control over the Teams card layout and include dynamic Catalog Item variables, is to use Messaging Content and build a custom Teams message/card rather than modifying the OOTB approval notification. ServiceNow supports dynamic notification content and buttons/actions for Microsoft Teams.

So, I would start with sn_now_teams.ApprovalsVAUtil for standard RITM/approval fields. If the requirement specifically includes Catalog Item variables, then use a controlled server-side approach to make those values available to the notification rather than trying to treat the variables as normal RITM fields.