AdvoLogix Help

Upload Salesforce Files to iManage Workspace via Automation

Updated on

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.


  1. In Salesforce setup, enter Flows into the Quick Find box and select Flows.
  2. Select the New Flow action button in the page header to initiate a new Salesforce flow wizard.
  3. Switch to the All + Templates tab.
  4. Select the iManage: Upload Document template from the list of available templates.
  5. 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

  1. Choose iManage Event as the platform event Trigger mechanism. AdvoLogix generates this Platform Event whenever a new Salesforce File is created within your organization.

  2. 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.

  3. 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.

  4. A loop element that traverses all of the linked entities of the Salesforce File.

  5. 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.

  6. 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.

  7. A loop element that traverses all Workspaces found for the associated record.

  8. 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.

  9. Make a chatter post on the record when the document is uploaded successfully in iManage.

  10. Make a chatter post on the record when the document upload fails with some error details encountered during the process.

  11. Make a chatter post on the record when we are not able to find any workspaces configured or associated with the Salesforce record.

  12. 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.

How do I upload existing Salesforce Files to iManage?

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

  1. Set up and activate the Upload Document Flow. You can utilize the same Salesforce Flow that has been described above.
  2. 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 );
Click to copy

Replace the <Existing_Salesforce_File_Record_Id> with the actual Salesforce File's record id.

Path 2: Using a Custom Developed Triggering System

  1. Create a flow or lightning component that can execute the APEX code.
  2. 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.

Previous Article Create an iManage Workspace via Automation
Next Article Update an iManage Workspace Name via Automation
Still need help? Click here!
AdvoLogix® is a registered trademark of AdvoLogix.com LLC a Texas Limited Liability Company. All references to other trademarks belonging to third parties that appear on this website, documentation, or other materials shall be understood to refer to those registered trademarks owned by others, and not to any trademark belonging to AdvoLogix. Otherwise, all material herein is the copyright of AdvoLogix.com LLC. All Rights Reserved.