@mentions - how to configure?

Should mentioning a user in a rich text field currently do anything? In 2024.9.5, I can @mention users in rich text fields, but no notifications happen. Do I need to write a workflow to detect mentions and create the notification or is that supposed to be happening natively?

You would have to write a workflow to detect the mentions!

1 Like

Ok. Am I thinking about this correctly though - that any module and any rich text field would need a workflow to detect new or updated mentions? That seems like it might get difficult to maintain. Is there any way to disable the @mention feature on certain modules? IE, maybe I just want to allow @mentions on a comments module and nowhere else.

You will find below a workflow that’s able to parse your comment mentions. The end of the workflow need to be implemented depending on you use case (sending an email, send a notification). Feel free to reuse or share it.

{
  "workflows": [
    {
      "handle": "",
      "enabled": false,
      "meta": {
        "name": "Demo - mentions",
        "description": "",
        "visual": {}
      },
      "keepSessions": 0,
      "steps": [
        {
          "stepID": "3",
          "kind": "iterator",
          "ref": "loopEach",
          "arguments": [
            {
              "target": "items",
              "expr": "commentContentArray",
              "type": "Array"
            }
          ],
          "results": [
            {
              "target": "currentString",
              "expr": "item",
              "type": "Any"
            }
          ],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": true,
              "id": "3",
              "parent": "1",
              "value": "Items",
              "xywh": [
                3016,
                2776,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "4",
          "kind": "gateway",
          "ref": "excl",
          "arguments": null,
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": true,
              "id": "4",
              "parent": "1",
              "value": "Exclusive",
              "xywh": [
                3016,
                3056,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "5",
          "kind": "expressions",
          "ref": "",
          "arguments": [
            {
              "target": "mentionned_userID",
              "expr": "trimLeft(trimRight(commentContentArray[index], \"\\\"\"), \"data-id=\\\"\")",
              "type": "ID"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": true,
              "id": "5",
              "parent": "1",
              "value": "Define and mutate scope variables",
              "xywh": [
                3016,
                3216,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "6",
          "kind": "continue",
          "ref": "",
          "arguments": null,
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": true,
              "id": "6",
              "parent": "1",
              "value": "Skip current iteration",
              "xywh": [
                3368,
                3056,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "7",
          "kind": "termination",
          "ref": "",
          "arguments": null,
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": true,
              "id": "7",
              "parent": "1",
              "value": "Terminate workflow execution",
              "xywh": [
                3368,
                2776,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "8",
          "kind": "expressions",
          "ref": "",
          "arguments": [
            {
              "target": "index",
              "expr": "index + 1",
              "type": "Integer"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": true,
              "id": "8",
              "parent": "1",
              "value": "Define and mutate scope variables",
              "xywh": [
                3016,
                2928,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "9",
          "kind": "expressions",
          "ref": "",
          "arguments": [
            {
              "target": "commentContentArray",
              "expr": "split(record.values.content, \" \")",
              "type": "Array"
            },
            {
              "target": "commentAuthorID",
              "expr": "record.ownedBy",
              "type": "ID"
            },
            {
              "target": "index",
              "expr": "0",
              "type": "Integer"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "9",
              "parent": "1",
              "value": "define editedComment, commentAuthor",
              "xywh": [
                3016,
                2640,
                200,
                80
              ]
            }
          }
        }
      ],
      "paths": [
        {
          "parentID": "9",
          "childID": "3",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "11",
              "parent": "1",
              "points": [],
              "style": "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "3",
          "childID": "8",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "12",
              "parent": "1",
              "points": [],
              "style": "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;",
              "value": "Body"
            }
          }
        },
        {
          "expr": "currentString == \"data-type=\\\"mention\\\"\"",
          "parentID": "4",
          "childID": "5",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "13",
              "parent": "1",
              "points": [],
              "style": "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;",
              "value": "si currentString == 'data-type=\"mention\"'"
            }
          }
        },
        {
          "parentID": "4",
          "childID": "6",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "14",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": "sinon"
            }
          }
        },
        {
          "parentID": "8",
          "childID": "4",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "15",
              "parent": "1",
              "points": [],
              "style": "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "3",
          "childID": "7",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "16",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": "End"
            }
          }
        }
      ],
      "triggers": [
        {
          "resourceType": "compose:record",
          "eventType": "beforeCreate",
          "constraints": [
            {
              "name": "namespace.handle",
              "op": "=",
              "values": [
                "your-namespace"
              ]
            },
            {
              "name": "module.handle",
              "op": "=",
              "values": [
                "comments"
              ]
            }
          ],
          "enabled": true,
          "stepID": "9",
          "meta": {
            "description": "",
            "visual": {
              "defaultName": true,
              "edges": [
                {
                  "childID": "9",
                  "meta": {
                    "description": "",
                    "label": "",
                    "visual": {
                      "id": "17",
                      "parent": "1",
                      "points": [],
                      "style": "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;",
                      "value": null
                    }
                  },
                  "parentID": "10"
                }
              ],
              "id": "10",
              "parent": "1",
              "value": "Compose - Record - Before Create",
              "xywh": [
                3016,
                2504,
                200,
                80
              ]
            }
          }
        }
      ]
    }
  ]
}
2 Likes