Skip to main content
Skip table of contents

sfdc-chatter-doclinker

This command requires additional license i.e. Dynamo Online Collaboration module must be enabled.

An HTML content command that generates a component displaying the Chatter feed of a specific record and provides functionality for creating Chatter posts linked to specific points on a document displayed on the same screen. Due to this linking functionality, it is basically required that a document is displayed on the screen alongside this component, either in editable or non-editable form and within a container element that allows scrolling. 

The generated component consists of two parts, a text editor at the top for creating new posts, and the Chatter feed below it. It will also affect the display of the document content, but on screens only - nothing the component does should be visible on a PDF generated out of the document HTML, for example.

All changes this component causes to the related Chatter feed are immediate. Leaving the screen or closing the browser tab will not cancel the changes. However, any changes done to the feed through other means, eg. in Salesforce, will not be reflected in this component's feed display.

Posting and creating links

When the user clicks a location in the document that is eligible for linking, the "Share" button below the text editor above the Chatter feed lights up. When that button is pressed, a new post is created that is then linked to the document location that was clicked. Document locations eligible for linking are as follows:

  • Any non-editable element in the document HTML that has the attribute "id" defined. Clicking any such element will highlight it to show what exactly will be linked.

  • Any editable content in the document HTML. If editable content is selected/highlighted, that particular selection is linked. If editable content is just clicked with no characters selected, the entire editable container element is linked.

The text editor allows the content of the new post to be defined; whatever is in the editor at the time the "Share" button is pressed will be the post's content. Besides formatting the contents using the controls in the toolbar, users can add mentions by typing the '@' character followed by letters; any Users whose names start with the letters are offered as possible options and inserted as a mention when selected. The set of Users that can be mentioned are defined through the mention-options attribute, and should that attribute's value be undefined, this mention functionality will not be available.

Links between the feed and the document

Any new posts created through this component are linked to specific points in the document. This link is visible in both the post and the document. In the document you can see speech bubble icons showing the linked locations, and in the case of editable locations, the linked content is also highlighted. Clicking the speech bubble will highlight the linked post in the feed. The post itself contains a "Locate" command, which upon clicking will then highlight the linked location in the document.

This link between a post and a document location is formed by one containing information of the other. The specifics differ depending on whether the document location is editable or not.

  • In case of non-editable locations and editable containers, the ID of the linked location is written into the Chatter post, eg. "location:some-element-id". This component itself will not display this location-marking part of the posts, but it will be visible if the post is viewed through any other way, such as within Salesforce. Modifying the post content to remove this part will break the link. Similarly, changing the ID of the linked document element will break the link.

  • In case of editable selections, the data of the linked Chatter post is written into the document content. A new span element wrapping the selection is created and holds data of the linked post, and also visually highlights the selection as the document is displayed on a screen. If the user deletes this span element in its entirety, the linked post no longer has anything to link to. This method of linking also necessitates the saving of the edited content as the user leaves the screen, as otherwise the data-containing span element will be gone and the link broken.

Other feed functionality

Besides being able to locate the document parts linked to the posts, users are able to  post comments and delete posts. Comments may be posted by typing them into the text box below a post, or its latest comment, and pressing the "Comment" button. Any post may be deleted by clicking the cross icon at the top-right corner, followed by clicking the "Delete post" command that appears. If the deleted post was linked to an editable selection, the link information is also removed from the document (and like with creating this link, this change also necessitates saving the document's edited content).          

Compact usage notes

  • Use this content command only on a screen in which a document is also displayed within a scrolling container element.  

  • If the document contains editable areas, save the edited contents regardless of the way in which the user leaves the screen.

Attributes

record-id

Required

Value type

EL-evaluated

Yes

String

Yes

Defines the ID of the record whose Chatter feed this component displays and is able to modify.

mention-options

Required

Value type

EL-evaluated

No

Collection

Yes

Defines the users who can be mentioned in new Chatter posts created through this component. The resolved value is expected to be a Collection of Data Items with data of User records, the fields Id and Name specifically.

If not defined, mentions cannot be added to new posts. 

starting-post-id

Required

Value type

EL-evaluated

No

String

Yes

Defines an existing post in the feed that will be marked with an icon and automatically highlighted right after the screen is loaded. The resolved value is expected to be the ID of a FeedItem record in the displayed feed.   

view-only

Required

Value type

EL-evaluated

No

Boolean

Yes

This attribute can be used to make it so that the feed can only be viewed - no posting, no commenting, no deleting. If the resolved value of this attribute is Boolean true, the component goes into this view-only state.

If undefined, value of false is used.

deletion-disabled

Required

Value type

EL-evaluated

No

Boolean

Yes

This attribute can be used to remove the feed viewers' capability of deleting posts. If the resolved value is Boolean true, the deletion button at the top corner of each post will not be available.

If the attribute view-only resolves into true, the deletion button is gone regardless of the value of this attribute.

If undefined, value of false is used.

Examples

The sfdc-chatter-doclinker command should be easy to set up as far as its attributes go. At the minimum, it just needs the ID of a record whose Chatter feed you want it to display and modify. Providing the mention options shouldn't be too tricky either, as the query command provides the kind of value mention-options asks for if you query User records with the fields Id and Name included.      

CODE
<query var="dynamoUsers" select="SELECT Id, Name FROM User WHERE IsActive = true AND Division = 'Dynamo'">....<sfdc-chatter-doclinker record-id="someRecordId" mention-options="dynamoUsers">
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.