Has anyone figured out how to @ mention a user in a comment using a process integration? I have a use case where we would like to mention specific users alongside doing an ad-hoc email when a certain ticket is put in.
Thank you so much, this worked perfectly for both hardcoding the user & doing it dynamically.
The long answer…..
I found a way to create functional @mentions in comments generated through an SWSD Process Integration.
The solution came from inspecting the network payload generated by SWSD when a user or group is mentioned manually in a comment.
SWSD generates a mention using HTML similar to this:
<span class="user_with_avatar waiting CommentRichText__mention___jAIXM" data-id="UNIQUE_ID" data-klass="Group"> <span class="username" style="color: #2569e6;"> @DISPLAY_NAME </span> </span>
The important part is the data-id.
data-id
data-id is the unique SWSD identifier used internally to determine which user or group is actually being mentioned.
The visible text, for example:
@Test User
or:
@Test Facilities Group
is only the label displayed in the comment.
The actual mention target is determined by:
data-id="..." data-klass="Group"
I identified these IDs by inspecting the JSON returned for users/groups and comparing it with the network payload generated by a manual @mention .
For an actual SWSD Group, data-id is simply the Group ID.
For example:
Group name: Test Facilities Group Group ID: 5123456
A manual SWSD mention generates:
data-id="5123456" data-klass="Group"
The interesting part is how SWSD handles individual users.
A user has a normal User ID, for example:
{ "id": 3123456, "name": "Test User", "group_ids": [ 5234567, 5345678, 5456789 ] }
The normal User ID is:
3123456
but the ID used by the SWSD mention mechanism is the user's associated Group ID.
From the user JSON records I inspected, this mention-specific Group ID was consistently the first value in the group_ids array:
group_ids
group_ids[0]
For the example above:
User ID: 3123456 Mention data-id: 5234567
Another inspected user showed the same pattern:
"group_ids": [ 5567890, ... ]
and the manual mention payload used:
data-id="5567890" data-klass="Group"
So, in the cases tested:
User mention data-id = first value in group_ids[]
SWSD also exposes this directly for a User custom field through:
{{User field.user.group_id}}
If the group is fixed, the Group ID and name can simply be hard-coded.
Example:
{ "comment": { "body": "<p><span class=\"user_with_avatar waiting CommentRichText__mention___jAIXM\" data-id=\"5123456\" data-klass=\"Group\"><span class=\"username\" style=\"color: #2569e6;\">@Test Facilities Group</span></span> </p>", "is_private": false } }
In this example:
data-id = 5123456 display = @Test Facilities Group data-klass = Group
This generates a functional mention of the SWSD group.
The same approach can be used dynamically with a User-type custom field.
For example, I have a User custom field called:
New hire
The working Process Integration payload is:
{ "comment": { "body": "<p><span class=\"user_with_avatar waiting CommentRichText__mention___jAIXM\" data-id=\"{{New hire.user.group_id}}\" data-klass=\"Group\"><span class=\"username\" style=\"color: #2569e6;\">@{{New hire.name}}</span></span> Test mention</p>", "is_private": false } }
The two variables have different purposes:
{{New hire.user.group_id}}
provides the unique mention target and is inserted into:
data-id="{{New hire.user.group_id}}"
while:
{{New hire.name}}
provides the visible name:
@{{New hire.name}}
After variable resolution, SWSD effectively receives something like:
<span class="user_with_avatar waiting CommentRichText__mention___jAIXM" data-id="5234567" data-klass="Group"> <span class="username" style="color: #2569e6;"> @Test User </span> </span>
data-klass="Group"
This was initially confusing.
Network inspection showed that SWSD uses:
not only when mentioning an actual SWSD Group, but also when mentioning an individual user through this mechanism.
For an individual user, the value used in data-id is not the user's normal User ID. It is the associated user Group ID.
Therefore:
Normal User ID ≠ Mention data-id
Instead:
User JSON → group_ids[0]
corresponds to the mention data-id in the cases tested.
For a User custom field, SWSD makes that value available directly as:
The visible name does not determine who is actually mentioned.
<span data-id="5234567" data-klass="Group"> <span class="username">@Test User</span> </span>
The actual SWSD mention target is determined by:
5234567
The text:
is only the label shown in the comment.
This means that if the visible name is correct but data-id is wrong, the comment may look correct while pointing to the wrong entity or failing to behave as a real SWSD mention.
Fixed Group → data-id = Group ID → display = @Group Name Dynamic User custom field → data-id = {{User field.user.group_id}} → display = @{{User field.name}}
For users, the mention-specific ID can also be identified by inspecting the user JSON; in the users tested, it corresponds to the first ID in the group_ids list.
This allows a Process Integration to create an actual SWSD @mention rather than simply inserting text that looks like one .
I assume you will hard code this in process or not?
I wanted to share a new dashboard a co-worker ( @mblackburn ) came up with to help us better view groups of interfaces and various metrics for each. Using a single HTML widget, we are able to visually compare numerous different interfaces by populating each interface dataset onto its own graph. We are able to view…
PALO-ALG - Logging.xmlPalo Alto Networks ALG Security Technical Implementation Guide :: Version 2, Release: 3 Benchmark Date: 27 Oct 2022
Alert Cleared.htmlHello, I would like to share the HTML template details we have prepared so that Solarwinds alarms can become more meaningful. It can list alarm object details and connected device details separately in HTML template. Except for object and device details, you can easily add custom property information…
Cisco ASR Devices.pollerCisco ASR Devices