9 Replies Latest reply on Sep 17, 2014 2:57 PM by ryanrutan

    Creating @mentions that work in dynamic content items

    henryhbruce

      I'm having problems creating proper @mentions in dynamically created content.

       

      For example, take the discussion content item that's created when the Share State action is clicked in the Getting Started > Creating a List Tile with the Jive Node SDK tutorial and say I wanted to @mention a user in the content of this document. From observing the content that's sent to Jive when I @mention in a manually created content item, I think I need to amend the obj that's passed to osapi.jive.corev3.discussions.create in tiles\sampletile-list\public\javascripts\action.js as below (specifically the contents of the <a...>...</a>), assuming @userid and @username represent a valid Jive User ID and User Name:

              var obj = {
                  "content": {
                      "type": "text/html",
                      "text": '<p>'+message+'</p><p>Current count is <b>'+config.count + '</b>, created by <a class=\"jive-link-profile-small jive_macro jive_macro_user\" href=\"javascript:;\" jivemacro=\"user\" data-type=\"person\" data-objecttype=\"3\" data-id=\"@userid\" ___default_attr=\"@userid\" data-orig-content=\"@username\">@username</a></p>'
                  },
                  "subject": $("#subject").val(),
                  "visibility": "place",
                  "parent": parent
              }
      

       

      The problem I'm facing is that, although this renders correctly, on cursor hover-over, the user's information doesn't appear and, the user's activity stream doesn't reflect that they've been @mentioned in the created discussion. I think I'm missing an additional REST API call to indicate that there @mentions in the content item, but I can't work out which to use from the reference documentation.

      Any help very gratefully received!

      Henry