You can configure a Visualforce Page to run one or more Alfresco Search Queries.
To use the Recommended Content feature, a Visualforce page must be added to your Salesforce organization using the following pattern:
<apex:page standardController="<Salesforce Object>">
<apex:canvasApp id="AlfCanvas" applicationName="<The name of your Connected App>" width="100%" height="450px" scrolling="auto" parameters="<A JSON Object the follows the structure documented below>"/>
</apex:page>
The structure of the parameters object is:
{'recommended': [
{'id': 1, 'name': 'Name 1', 'query': 'Alfresco Search Query (afts syntax)' },
{'id': 2, 'name': 'Name 2', 'query': 'Alfresco Search Query (afts syntax)', maxResults : 10 }
{'id': 3, 'name': 'Name 3', 'query': 'Alfresco Search Query (afts syntax)', 'sort': [{'field':'cm:name', 'ascending':true}] },
{'id': 2, 'name': 'Name 2', 'query': 'Alfresco Search Query (afts syntax)', 'sort': [{'field':'cm:modified', 'ascending':false}], 'maxResults': 7 }
]}
The id, name, and query parameters are mandatory. The sort and maxResults are optional but have pre-defined values if you don't configure them.
In a simple scenario the sales administrator curates the recommended content into two specific folders within Alfresco Content Services. These folders are visible when you create new opportunities in Salesforce. In this case the sales administrator could configure something similar to the following examples, which display two sections by running two Alfresco search queries to list content within two specific parent folders:
Example 1:
<apex:page standardController="Opportunity">
<apex:canvasApp id="AlfCanvas" applicationName="Alfresco_Salesforce_Connector" width="100%" height="450px" scrolling="auto"
parameters="{'recommended':[
{'id': 1, 'name': 'Data Sheets', 'query': 'PARENT:\'workspace://SpacesStore/38745585-816a-403f-8005-0a55c0aec813\' AND TYPE:content'},
{'id': 2, 'name': 'Competitive Info', 'query': 'PARENT:\'workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b\' AND TYPE:content'}]}"/>
</apex:page>
Note
The parent nodeRef can be copied from the Share URL when listing a folder. A path query could be used instead of a parent query but will stop working if the folder is renamed or moved.
Example 2:
<apex:page standardController="Opportunity">
<apex:canvasApp id="AlfCanvas" applicationName="Alfresco_One_for_Salesforce" width="100%" height="500px" scrolling="auto"
parameters="{'recommended':[
{'id':1,'name':'Customer Presentation','query':'(=TS:Solution:\'Content Management\') AND (=TS:SalesMotion:\'Propose Solution\') AND (=TS:MarketingContentType:\'Customer Presentation\')'},
{'id':2,'name':'Datasheets','query':'(=TS:Solution:\'Content Management\') AND (=TS:SalesMotion:\'Propose Solution\') AND (=TS:MarketingContentType:\'Datasheet\')'},
{'id':3,'name':'Demo Video','query':'(=TS:Solution:\'Content Management\') AND (=TS:SalesMotion:\'Propose Solution\') AND (=TS:MarketingContentType:\'Demo Video\')'},
{'id':4,'name':'Training - Technical','query':'(=TS:Solution:\'Content Management\') AND (=TS:SalesMotion:\'Propose Solution\') AND (=TS:MarketingContentType:\'Training- Technical\')'}
]}"/>
</apex:page>