Chatter Files Data Source Action

  • 1
  • Question
  • Updated 12 months ago
I have a use case where I need to share files with different records.  The basic approach is to use the skuid file upload component to attach content to a record (i.e. a custom project document library), then we have superusers that will select files that will be reshared to other records that provide additional access.

The basic idea is that there are different personas that have different access levels which are enforced based on object records that have been shared.  Given some limitations that salesforce has with directly manipulating the ContentDocumentLink object, a good native way to handle this is to create chatter posts on the target records linking the original content record.  Note that we're not having users directly interact with Chatter through the UI.

With salesforce data source actions, it's pretty easy to setup a chatter post, but is there a way to add a document link as well?  This is possible with the Salesforce chatter REST API, but if there's a way in the SKUID XML to add the file reference, that would be preferred.  Here's the API post message from Salesforce's documentation.  The 'capabilities' segment is the one that would need to be added.  The rest seems to work fine with the skuid pagebuilder.
{
   "body":{
      "messageSegments":[
         {
            "type":"Text",
            "text":"Please take a look at these files."
         }
      ]
   },
   "capabilities":{
      "files":{
         "items": [
            {"id": "069D00000001IOh"},
            {"id": "069D00000002IOg"}
         ]
      }
   },
   "subjectId":"me",
   "feedElementType":"FeedItem" 
}

Here's the XML segment from the data source action:

                        <action type="datasource-action" datasource="salesforce" actionname="chatterPost">
                            <inputs>
                                <input name="subjectNameOrId" displaytype="string" value="a2D1A000000DCkC"/>
                                <input name="text" displaytype="string" value="Test Posting"/>
                                <input name="visibility" displaytype="picklist" value="allUsers"/>
                            </inputs>
                        </action>
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,474 Points 2k badge 2x thumb

Posted 12 months ago

  • 1

Be the first to post a reply!