AdvoLogix provides a wide range of Apex invocable and global methods that allows users to easily execute different iManage related actions as part of your flow, process builder, or from an Apex class.
List of Available Apex Invocable Methods
There are many different iManage related actions that can be automated with the AdvoLogix Connector for iManage and Salesforce. Here is a list of all available Apex methods:
- Create Workspace (iManageServiceCreateWorkspace)
- Update Workspace (iManageServiceUpdateWorkspace)
- Find Workspaces (iManageServiceLookupWorkspace)
- Upload Document (iManageServiceUploadDocument)
- Merge Workspaces (iManageServiceGlobal.mergeWorkspaces)
- Create Folder (iManageServiceCreateFolder)
- Update Folder (iManageServiceUpdateFolder)
Adding an Apex method to a flow is a very simple task. Adding an Apex method to a flow is a very simple task. You just need to drag and drop or add an Action item into the Flow Builder canvas. Filter the actions by Category, select the iManage Connector, and select Create Workspace under the Action lookup field.
Create Workspace
Drag and drop or add an Action item in the Flow Builder canvas. Filter the actions by Category, select the iManage Connector, and select Create Workspace under the Action lookup field.
Input Values
- Record ID - Provide the current record's record Id value here.
- iManage Library - [optional] Provide an iManage library name.
- iManage Workspace Template - [optional] Provide an iManage workspace template id.
- 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 a Secured Login within iManage Setup. For more details, follow this link.
- Use Asynchronous Method - Provide a true/false value to mark this process to be executed as an asynchronous approach.
When Use Asynchronous Method is true, then the output value for the iManage Workspace is returned as null.
Output Values
When the Workspace has been created successfully, this method will return an iManage Workspace apex data-type variable output. The response will contain values such as workspace id and workspace name, along with all custom profile data values and descriptions.
Salesforce does not allow Rest API executions or DML operations such as inserting or updating Salesforce records in a single transaction. In these cases, Salesforce alerts the user with the error 'You have uncommitted work pending. Please commit or rollback before calling out'. In situations where this error occurs, AdvoLogix advises users to set Use Asynchronous Method to True.
Example Apex script:
imanage.iManageServiceCreateWorkspace.Request req1 = new imanage.iManageServiceCreateWorkspace.Request();
req1.recordId = '0010C00000WxO5fUAF';
req1.useAsynchronousMethod = false;
imanage.iManageServiceCreateWorkspace.Request[] reqList = new imanage.iManageServiceCreateWorkspace.Request{ req1 };
imanage.iManageServiceCreateWorkspace.Response[] resp = imanage.iManageServiceCreateWorkspace.process( reqList );
system.debug('Create Workspace Response :: '+resp[0]);
Update Workspace
This action method requires old and new record field values to work appropriately, and thus must be used when the flow is executing as a record-triggered update event.
Drag and drop or add an Action item in the Flow Builder canvas. Filter the actions by Category, Select iManage Connector and Update Workspace under the Action lookup field.
Select Objects
- Object for "SObject Record (New)" (Input) - Select an object in which the current flow is set to be triggered from.
- Object for "SObject Record (Old)" (Input) - Select an object in which the current flow is set to be triggered from.
Input Values
- SObject Record (New) - Provide the record object/variable that stores the data of the record that has been changed. (Normally it will be {!$Record} variable)
- SObject Record (Old) - Provide the record object/variable that stores the data of the record that was saved in the database before the new changes. (Usually it should be {!$Record__Prior} variable)
- iManage Library - [optional] Provide an iManage library name.
- 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 the Secured Login within iManage Setup. For more details, follow this link.
- Use Asynchronous Method - Provide a true/false value to mark that this process is to be executed as an asynchronous approach.
When Use Asynchronous Method is True, then the output value for iManage Workspace is returned as null.
Output Values
When the Workspace name has been changed successfully, this method will return an iManage Workspace apex data-type variable output. The response will contain values such as workspace id and workspace name, along with all the custom profile data values and descriptions.
Salesforce does not allow Rest API executions and DML operations such as inserting, updating Salesforce records in single transaction. In these cases Salesforce alerts user with an error 'You have uncommitted work pending. Please commit or rollback before calling out'. In situations where this error occurs, AdvoLogix advises users to set Use Asynchronous Method to True.
Example Apex script:
imanage.iManageServiceUpdateWorkspace.Request req1 = new imanage.iManageServiceUpdateWorkspace.Request();
req1.sObject_NewRecord = new Account(Id='0010C00000WxO5fUAF', Name='Test Account New Name');
req1.sObject_OldRecord = new Account(Id='0010C00000WxO5fUAF', Name='Test Account Old Name');
req1.useAsynchronousMethod = false;
imanage.iManageServiceUpdateWorkspace.Request[] reqList = new imanage.iManageServiceUpdateWorkspace.Request{ req1 };
imanage.iManageServiceUpdateWorkspace.Response[] resp = imanage.iManageServiceUpdateWorkspace.process( reqList );
system.debug('Update Workspace Response :: '+resp[0]);
Find Workspaces
Drag and drop or add an Action item in the Flow Builder canvas. Filter the actions by Category and select the iManage Connector and select Find Workspace under the Action lookup field.
Input Values
- Record ID - Provide the current record id value here.
- 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 the Secured Login within iManage Setup. For more details, follow this link.
Output Values
On successful execution of the method, it will return the List of iManage Workspaces apex data-type variable output that has been identified as associated with the Salesforce record. Each workspace item in the response will contain values such as workspace id and workspace name, along with all custom profile data values and descriptions.
This method auto-validates whether Workspace Manager Configuration exists and is active for the object this record belongs to. If an active configuration is not found, then this method returns no workspaces associated with the record.
Example Apex script:
imanage.iManageServiceLookupWorkspace.Request req1 = new imanage.iManageServiceLookupWorkspace.Request();
req1.recordId = '0010C00000WxO5fUAF';
imanage.iManageServiceLookupWorkspace.Request[] reqList = new imanage.iManageServiceLookupWorkspace.Request{ req1 };
imanage.iManageServiceLookupWorkspace.Response[] resp = imanage.iManageServiceLookupWorkspace.process( reqList );
system.debug('All Found Workspaces For the Record :: '+resp[0].workspaces);
Upload Document
Drag and drop or add an Action item in the Flow Builder canvas. Filter the actions by Category and select iManage Connector and select Upload Document under the Action lookup field.
Input Values
- Content Version ID - Provide the Salesforce File record id value here.
- iManage Folder Name - Provide the name of the folder, which already exists within the workspace provided in the iManage Workspace input.
- iManage Library - Provide an iManage library name.
- iManage Workspace - Provide an iManage workspace id.
- iManage Document ID - [optional] Provide an existing document's Id from iManage, using with this method will upload the Salesforce File to iManage as a new version of that document.
- 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 the Secured Login within iManage Setup. For more details, follow this link.
Output Values
On successful execution of this method, it will return the iManage Document apex data-type variable output. The response will contain values such as document id, document name, webview url, workspace name etc.
Example Apex script:
imanage.iManageServiceUploadDocument.Request req1 = new imanage.iManageServiceUploadDocument.Request();
req1.contentVersionId = '0690D00000WxO2fAAA';
req1.library = 'Active';
req1.workspaceId = 'Active!20213';
req1.folderName = 'Test folder';
imanage.iManageServiceUploadDocument.Request[] reqList = new imanage.iManageServiceUploadDocument.Request{ req1 };
imanage.iManageServiceUploadDocument.Response[] resp = imanage.iManageServiceUploadDocument.process( reqList );
system.debug('Uploaded Document in iManage Response :: '+resp[0].document);
Merge Workspaces
The Merge Workspaces operation from AdvoLogix will associate all linked workspaces for merged records to the master record that remains in the organization after the records merge.
KNOWN LIMITATION
The Merge Workspaces method is only available as a global method to be consumed within an Apex trigger, since the Salesforce Merge operation requires very specific execution points that Salesforce Flows do not support yet.
To support the merge workspaces operation for any object that can be merged in Salesforce, your administrator or developer must first create an Apex Trigger
on that object with an after delete
entry point.
Syntax:
iManageServiceGlobal.mergeWorkspaces(
@mergedRecordsJSONString,
@loginAsUserId,
);
Parameters:
@mergedRecordsJSONString
Provide a list of all merged records (excluding master record) as JSON serialized string.
@loginAsUserId
Provide current user's Id or a secured login enabled user's Id to authenticate the iManage specific API executions. (Pass null
to use current logged in user's iManage authentication context.)
The merge workspaces operation is only supported when the method is activated from the context of an after delete
Apex trigger. If after merge the user decides to restore the merged (deleted) records from the recycle bin, then your iManage workspaces will not be re-linked back to those records. That must be done manually by the user.
Example Apex trigger:
trigger AccountMergeTrigger on Account (after delete) {
if (trigger.isAfter && trigger.isDelete) {
iManageServiceGlobal.mergeWorkspaces( JSON.serialize(trigger.old), UserInfo.getUserId() );
}
}
Create Folder
Drag and drop or add an Action item in the Flow Builder canvas. Filter the actions by Category, select the iManage Connector, and select Create Folder under the Action lookup field.
Input Values
- Record ID - Provide the current record id value here.
- iManage Workspace - Provide an iManage workspace id.
- iManage Library - [optional] Provide an iManage library name.
-
iManage Folder Path - [optional] Provide an iManage folder path within the workspace. The folder path provided here will override the path determined by the Workspace Configuration setup for the object. The folder path must be provided with a syntax of
<folder name>/<folder name>
, where the last<folder name>
within the path will be treated as the base folder to be mapped to your record. - 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 the Secured Login within iManage Setup. For more details, follow this link.
- Use Asynchronous Method - Provide a true/false value to mark this process to be executed as an asynchronous approach.
When Use Asynchronous Method is true, then the output value for the iManage Folder is returned as null.
Output Values
When the folder has been created successfully, this method will return an iManage Folder apex data-type variable output. The response will contain values such as folder id and folder name, along with all custom profile data values and descriptions.
Salesforce does not allow Rest API executions or DML operations such as inserting or updating Salesforce records in a single transaction. In these cases, Salesforce alerts the user with the error 'You have uncommitted work pending. Please commit or rollback before calling out'. In situations where this error occurs, AdvoLogix advises users to set Use Asynchronous Method to True.
Example Apex script:
imanage.iManageServiceCreateFolder.Request req1 = new imanage.iManageServiceCreateFolder
.Request();
req1.recordId = '0010C00000WxO5fUAF';
req1.workspaceId = 'Dev!42';
req1.baseFolderPath = 'Region-US/Insurance Claims/ACME vs Florida';
req1.useAsynchronousMethod = false;
imanage.iManageServiceCreateFolder.Request[] reqList = new imanage.iManageServiceCreateFolder
.Request{ req1 };
imanage.iManageServiceCreateFolder
.Response[] resp = imanage.iManageServiceCreateFolder
.process( reqList );
system.debug('Create Folder Response :: '+resp[0]);
Update Folder
Drag and drop or add an Action item in the Flow Builder canvas. Filter the actions by Category, Select iManage Connector and Update Folder under the Action lookup field.
Select Objects
- Object for "SObject Record (New)" (Input) - Select an object in which the current flow is set to be triggered from.
- Object for "SObject Record (Old)" (Input) - Select an object in which the current flow is set to be triggered from.
Input Values
- SObject Record (New) - Provide the record object/variable that stores the data of the record that has been changed. (Normally it will be {!$Record} variable)
- SObject Record (Old) - Provide the record object/variable that stores the data of the record that was saved in the database before the new changes. (Usually it should be {!$Record__Prior} variable)
-
iManage Workspace - Provide an iManage workspace id.
- iManage Library - [optional] Provide an iManage library name.
- 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 the Secured Login within iManage Setup. For more details, follow this link.
- Use Asynchronous Method - Provide a true/false value to mark that this process is to be executed as an asynchronous approach.
When Use Asynchronous Method is True, then the output value for iManage Folder is returned as null.
Output Values
When the Folder name has been changed successfully, this method will return an iManage Folder apex data-type variable output. The response will contain values such as folder id and folder name, along with all the custom profile data values and descriptions.
Salesforce does not allow Rest API executions and DML operations such as inserting, updating Salesforce records in single transaction. In these cases Salesforce alerts user with an error 'You have uncommitted work pending. Please commit or rollback before calling out'. In situations where this error occurs, AdvoLogix advises users to set Use Asynchronous Method to True.
Example Apex script:
imanage.iManageServiceUpdateFolder.Request req1 = new imanage.iManageServiceUpdateFolder.Request();
req1.sObject_NewRecord = new Account(Id='0010C00000WxO5fUAF', Name='Test Account New Name');
req1.sObject_OldRecord = new Account(Id='0010C00000WxO5fUAF', Name='Test Account Old Name');
req1.workspaceId = 'Dev!42';
req1.useAsynchronousMethod = false;
imanage.iManageServiceUpdateFolder.Request[] reqList = new imanage.iManageServiceUpdateFolder.Request{ req1 };
imanage.iManageServiceUpdateFolder.Response[] resp = imanage.iManageServiceUpdateFolder.process( reqList );
system.debug('Update Folder Response :: '+resp[0]);
This action method requires old and new record field values to work appropriately, and thus must be used when the flow is executing as a record-triggered update event.
When the iManage Library name is provided within an Apex action, all iManage Work related operations are executed within the provided library, otherwise we base the operations from the library provided from Workspace Manage 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.
Where do I find my iManage Workspace Template Id?
From within the iManage Control Center >> Settings >> Templates, open the detail view of the desired Workspace Template and extract the id from the browser's address field as highlighted below in blue:
<Base iManage Work URL>/work/cc/templates/template/Dev!1615/detail