AdvoLogix provides a built-in Apex method to auto-upload Salesforce Files to iManage Workspace via Salesforce Flows.
Create a Flow to Upload a Salesforce File to a Folder within iManage Workspace
A background automation can be set using a Platform Event which AdvoLogix generates for any new Salesforce File uploaded in your organization. AdvoLogix provides a Flow Template named iManage: Upload Document, which includes the preconfigured setup of actions needed to accept an uploaded Salesforce file, read the file's associated record and then find workspaces associated with that record and upload the file to a specific folder within the workspace.
- In Salesforce setup, enter Flows into the Quick Find box and select Flows.
- Select the New Flow action button in the page header to initiate a new Salesforce flow wizard.
- Switch to the All + Templates tab.
- Select the iManage: Upload Document template from the list of available templates.
- Select the Next button.
You now have a custom flow that will be triggered when a Salesforce File is uploaded. Your administrator can customize the flow elements, including setting up more decision elements or applying more notification elements to inform users about uploaded document actions.
Understanding the Upload Document Flow Template Structure
- Choose iManage Event as the platform event Trigger mechanism. AdvoLogix generates this Platform Event whenever a new Salesforce File is created within your organization.
- Add a decision element to filter down the platform events to a specific type that identifies a Salesforce File has been generated in your organization. AdvoLogix always generates this platform event with Type = SALESFORCE_FILE_ADDED.
- After validating the type of platform event ,we retrieve the details of the saved Salesforce File using Get Salesforce File Data and Get all Linked Entities to the Salesforce File elements which provides all of the fields' data for the Salesforce File and all linked entities such as account, case, or other object records this file is associated with at present, respectively.
- A loop element that traverses all of the linked entities of the Salesforce File.
- A decision check has been added to further filter down which specific linked record's workspace we would like the saved file to be uploaded to in iManage. This decision is being made using the first three character-based identification of the linked entity's record id, which remains unique throughout your organization objects and can easily identify the object type of the linked record.
Note: If you want to copy a Salesforce File for a different linked object, then you should change this element decision criteria to verify a different object as the flow template will be set to check for the account as the default linked entity for the uploaded Salesforce File.
- Execute Find Workspaces, labeled as Find all Workspaces, Apex action provided by AdvoLogix as an iManage utility method. Find Workspaces Apex method supports the following parameters:
-
Record ID - Provide the Salesforce record's record Id value here. (In this template, this should be the LinkedEntityId field's value from Step D)
(For more details about this Apex Action follow this article) -
Login As User ID - Optionally, provide a user id to automatically authenticate all iManage Work related operations within this flow action. The provided user must be enabled as Secured Login within iManage Setup. For more details follow this article.
-
Record ID - Provide the Salesforce record's record Id value here. (In this template, this should be the LinkedEntityId field's value from Step D)
- A loop element that traverses all Workspaces found for the associated record.
- Execute Upload Document, labeled as Upload Documents to iManage, Apex action provided by AdvoLogix as an iManage utility method. Upload Document Apex method supports the following parameters:
- Content Version ID - Provide the Salesforce File record's record Id value here.
-
iManage Library - Provide an iManage library name. (In this template, this can be retrieved from the Find Workspace's
database
field value in Step F and Step G). -
iManage Workspace - Provide an iManage workspace id. (In this template, this can be retrieved from the Find Workspace's
id
field value in Step F and Step G). -
iManage Folder Name - Provide the name of the folder that exists within the workspace retrieved from the Find Workspace action in Step F and Step G.
(For more details about this Apex Action follow this article) -
Login As User ID - [optional] Provide a user id to automatically authenticate all iManage Work related operations within this flow action. The provided user must be enabled as Secured Login within iManage Setup. For more details follow this article.
- Make a chatter post on the record when the document is uploaded successfully in iManage.
- Make a chatter post on the record when the document upload fails with some error details encountered during the process.
- Make a chatter post on the record when we are not able to find any workspaces configured or associated with the Salesforce record.
- Make a chatter post on the record when the process to find all associated workspaces is encountered with any error.
In situations where you do not want a copy of your document stored in Salesforce Files, you may add an additional action item in the flow just before Step I, and add a Delete Records action element to delete the Salesforce File or update the Salesforce File with reference to your newly uploaded iManage document's URL.
If you want to move or copy existing Salesforce Files to related iManage Workspace(s) you have a couple of options that are defined below. However, please keep in mind that actual development steps may differ based on best practices involved in development of said function.
Path 1: Use AdvoLogix Platform Events Triggering System
- Set up and activate the Upload Document Flow. You can utilize the same Salesforce Flow that has been described above.
- Utilize the following APEX code to trigger the Salesforce Flow for uploading your existing Salesforce Files. The objective of the code provided here is to give you (as an administrator and developer within your organization) the ability to implement, in your own way, how to migrate existing Salesforce Files to iManage Work.
Note: We recommend adhering to all Salesforce best practices in the development of any custom functionality.
List<imanage__iManage_Event__e> eventsList = new List<imanage__iManage_Event__e>();
eventsList.add(
new imanage__iManage_Event__e (
imanage__Type__c = 'SALESFORCE_FILE_ADDED',
imanage__Payload__c = <Existing_Salesforce_File_Record_Id>
)
);
EventBus.publish( eventsList );
Replace the <Existing_Salesforce_File_Record_Id> with the actual Salesforce File's record id.
Path 2: Using a Custom Developed Triggering System
- Create a flow or lightning component that can execute the APEX code.
- Use the following APEX code to trigger a document upload.
Due to certain platform limitations, only a small size document (maximum 3 MB) can be transferred from Salesforce Files to iManage. To support larger files, up to 1 GB size, enable the Use AWS Cloud for File Uploading option in iManage Setup | iManage Configuration.
When the Library Name is provided, workspace operations are executed within the specified library, otherwise the workspace operations are executed within the library specified in the iManage Workspace Manager configuration for the object.
When a Login As user is provided within the app builder deployment options, all operations related to iManage Work are performed on behalf of that selected user. The current user cannot log in or log out from iManage Work from within the component.
If the provided secured logged in user logs out from their environment, then the user is logged out from all instances of the components where the secured login has been setup to use as via the Login As option.