Search by Resource Metadata
The "Search by Resource Metadata" flow action is a specialised feature designed for use with SharePoint and MS Teams, focusing on custom properties. This functionality allows users to efficiently search and manage resources(files & folders) by tags (metadata columns). By specifying key-value pairs, users can conduct targeted searches (exact match) within custom columns, ensuring that they can easily locate and retrieve the relevant resources based on the defined metadata criteria.
Please note, this action retrieves the files/folders with the exact matching key-value pairs.
For this action, users need to create a list in which they add key-value pairs that will look up values from the custom columns. The action will then return the resource associated with those custom properties. By leveraging this capability, users can efficiently filter and retrieve resources based on metadata defined in their SharePoint and MS Teams environment.
In your flow builder, search for the element named “CloudFiles : Search by Resource Metadata”. You can also find this action in the CloudFiles category when you click the "Action" element in the "Add Element" box. Select the action to insert it into the flow.
Here is a list of all input parameters with a summary. For details, check out the individual sections below -
- Condition (AND/OR) - Choose AND or OR depending on the key values of the custom columns in Sharepoint or MS Teams as required.
- Drive ID - This is for sharepoint and MS Teams users only. These cloud storages offer multiple 'drives' where documents can be uploaded.
- Library - Library is the desired Cloud based drive where you wish to create the folder.
- Properties - This is key values of the custom columns through which we retrieve desired files/folders.
Depending on the key values of the custom columns in SharePoint, specify AND or OR to define the logical condition that suits your requirements. This ensures that the criteria for filtering or processing data are accurately applied based on your specified key values.
Library is the desired Cloud based drive where you wish to create the folder. This is a simple text field and you can enter one of these options - sharepoint, MS Teams.
It's best to copy this parameter from the dialog box as shown in the image below.
This is important for MS Teams & sharepoint users only. These cloud storages offer multiple 'drives' where documents can be uploaded. Drive ID can be copied form the metadata dialog as shown below.
These parameters can be obtained within Salesforce with a single click by navigating to the parent folder in the Content Library Tab and clicking the "View Metadata" button as shown in image below. The Content Library Tab can be accessed from the CloudFiles App Launcher or an also be inserted onto any of your standard or custom apps.
Follow the steps below to retrieve these IDs -
- Click on App Launcher on top left. Search for the CloudFiles App.
- In the CloudFiles App, select the Content Library Tab.
- Go to your cloud storage. You may need to login if you haven't done so before.
- Go to the target folder where you would like to place the created folders in.
- A dialog box opens up which shows all the IDs. Copy the ID from here.
Once you have the drive ID, create a new resource with the following specifications: set the type to "constant," the data type to "text". For the value, go to the content library. From the view metadata section, add the drive ID to the resource. Finally, incorporate this newly created resource into the drive ID field of the flow action. This ensures that the drive ID is accurately linked and utilized within your automated workflow.
Here, you need to specify the property name in the external storage whose value must be updated or set. This property name determines which aspect of the file or folder you intend to search. This ensures that the automation correctly identifies the resources in the external storage system.
Now create a list of properties in which you need to define the newly created resource for example, "Property1" (as shown in the example) which is a variable resource with “Data type > Apex-defined” and “Apex class > cldfs_CloudFilesVariable”, similarly for "Property2".
Next, use the key in the value section of “Property1 > key” or “Property2 > key” with “Equals” operator, which is the name of the custom column. You can obtain this key by either navigating to Cloudfiles > Document Management > Widget Section > Choose any Custom Column or by directly looking up the name in your SharePoint library. This key will be used to accurately link the properties to the respective columns, ensuring proper data integration within your workflow.
Head over to Sharepoint and then in the custom columns, use the custom tags to specifically locate the file/folder which is to be retireved, for example, lets say I want to find all the files/folders associated with the custom tags “111111” from “CustomColumn1” and also “222222” from “CustomColumn2” so enter these custom tags in the “Property1 > valueString” and “Property2 > valueString” respectively.
Refer to the video below to have a visual understanding of the above parameters -
The Apex action returns a list of resources. If you require individual resource parameters, you should incorporate a loop into your flow. This loop will allow you to retrieve and process the details of each resource separately, based on the needs of your flow action. By doing so, you can efficiently access and utilise specific attributes of each resource for further operations or decision-making within your automated workflow.
A resource represents a file or a folder in external storage. It has following properties -
- Id - External Id of the Resource
- Type - One of file or folder
- Name - Name of the resource, with extension in case of files
- Library - One of sharepoint, google, onedrive, box, dropbox, cloudfiles
- DriveId - Drive Id in external storage. Only applicable for SharePoint & Sharepoint. You can get this value from Content Library.
- Path - This is the Cloud storage path of the newly created folder. It specifies the particular endpoint and resource you want to interact with, such as records, objects, or custom resources.