Skip to main content

Toolkit Details

Class Name: box.Toolkit

Instance Variables

mostRecentError

String to indicate the most recent error that occurred when calling instance methods. The presence of this string does not mean the operation did not succeed. It is possible the error was recoverable; however, the lack of a value in this string does indicate the operation was successful.

Enum CollaborationType

Enum to indicate the type of collaboration. Possible values: EDITOR, VIEWER, PREVIEWER, UPLOADER, COOWNER, OWNER, PREVIEWERUPLOADER, or VIEWERUPLOADER

Static Methods

deleteServiceUserAssociation

Method to clear association between Service Account and Box for Salesforce integration. This can be used to change the service account if an incorrect one is being used. Parameters:
  • None
Returns:
  • true if the user’s account existed and was deleted.
  • false if the user’s account was not deleted for any reason (including because it didn’t exist).

deleteUserAssociation

ParameterTypeDescription
userIdidThe ID of the user whose credentials are to be cleared.
Returns:
  • true if the user’s account existed and was deleted.
  • false if the user’s account was not deleted for any reason (including because it didn’t exist).

Instance Methods - Constructors, Destructors

box.Toolkit()

Parameters:
  • None

commitChanges

Treat this method as a destructor for the box.Toolkit() method.
This method is critical. It must be called after all folder / collaboration operations are complete. Every time. No Exceptions.
Since Salesforce doesn’t allow callouts after database updates / inserts / deletes have occurred, the Toolkit class maintains some collections of objects to be inserted once all callout operations are complete. If this method is not called, those objects won’t be in the database, and the tables that keep track of user / record / folder associations will be out of sync and will need some advanced debugging to fix. Parameters:
  • None
Returns:
  • Void

commitChanges with platform event

Treat this method as a destructor for the box.Toolkit() method. This method is very similar to the commitChanges above. However, it uses a platform event to commit changes to the database to perform DML statements in a different transaction and avoid governor limits in some scenarios.
ParameterTypeDescription
usePlatformEventbooleantrue if you’re using a platform event. false to call the original method.
Returns:
  • Void

Generic Methods

The Box for Salesforce Developer Toolkit provides a global method that accepts an HttpRequest object as a parameter and returns an HttpResponse object. This method uses the authentication details of the Service Account to make callouts to Box’s APIs, allowing you to focus on the business logic of your integration.

sendRequest

ParameterTypeDescription
requestHttpRequestAn HttpRequest object with a set endpoint and method.
Returns:
  • An HttpResponse object with the response details from calling Box’s APIs.
  • Toolkit.BoxApiException if there is any missing information from the HttpRequest input.
  • null if there was an issue getting the authentication details for the Service Account. In this case, check mostRecentError.

File Operations

createFileFromAttachment

Available in version 3.46 and above.Salesforce has a String length limit of 6 million characters. Due to string bloat in the base64 encoding/decoding process, this results in an effective file size limit of 4.3 megabytes for synchronous Apex and 8.6 megabytes for asynchronous Apex.
ParameterTypeDescription
attAttachmentThe attachment to be converted into a File in Box.
fileNameOverridestringOptional - Name of the new file. If no value is passed in, the name of the attachment is used.
folderIdOverridestringOptional - Box folder ID to place this attachment in. If no value is passed in, the file will be placed in the folder associated with the record that is the parentId of the attachment. If the record-specific folder doesn’t exist, it will be created.
accessTokenstringOptional - if accessToken is sent, that value is used for the Box API call. Otherwise, the default account credentials are used.
Returns:
  • string returned is the ID of the Box file that was created.
  • null if there was an error. In this case, check mostRecentError.

pushFileToBox

Uploads a Salesforce Files ContentVersion record to a Box folder.
The maximum supported file size is 25 MB, or 26,214,400 bytes. Files exceeding this limit are rejected with an error message showing the file name and size.
ParameterTypeRequiredDescription
cvIdidYesThe Salesforce ContentVersion ID to upload.
folderIdstringYesThe Box folder ID where the file will be placed.
Returns:
  • PartnerSyncResponse object with the upload details.
  • null if the upload fails. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • It validates that the ContentVersion exists before attempting the upload.
  • It checks the file size before upload so unsupported files fail early.
  • Box API and rate-limit errors are surfaced through mostRecentError.
  • Check mostRecentError when the method returns null.
Creates a shared link for a Box file.
ParameterTypeRequiredDescription
fileIdstringYesThe Box file ID to create a shared link for.
Returns:
  • string returned is the shared link URL.
  • null if the shared link is not created. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • It creates the shared link with the default Box permissions.
  • Check mostRecentError when the method returns null.

moveFile

Moves a Box file to a different folder.
ParameterTypeRequiredDescription
fileIdstringYesBox file ID of the file to move.
destinationFolderIdstringYesBox folder ID of the destination folder.
accessTokenstringNoIf accessToken is sent, that value is used for the Box API call. Otherwise, the default service account credentials are used.
Returns:
  • File object with the updated parent folder.
  • If the move fails, the returned File object can include a status value. Check mostRecentError for details.
Usage notes:
  • If accessToken is blank or null, the method uses service account credentials.
  • Check the returned File object’s status value for operation errors.
  • Check mostRecentError if the operation fails.

Folder Operations

getRootFolderId

Parameters:
  • None
Returns:
  • string returned is the Box folder ID of the Salesforce root folder.

getObjectFolderByRecordId

ParameterTypeDescription
recordIdidSalesforce record ID whose root folder ID you want to get.
Returns:
  • string returned is the Box folder ID of the object root folder for the record ID passed in.

getFolderUrl

  • This method gets the embed widget URL for a particular record so customers can use their own embed logic if desired.
  • This method respects seamless login settings so the URL will automatically log the user in if seamless login is enabled.
ParameterTypeDescription
recordIdidSalesforce record ID whose root folder ID you want to get.
isMobileContextbooleanBoolean to indicate whether the URL should be mobile (true) or not (false).
Returns:
  • string returned is a URL that points to the folder associated with the Salesforce record ID passed. This URL is for the Box Embed Widget and can be embedded in any Visualforce page.

createObjectFolderForRecordId

ParameterTypeDescription
recordIdidSalesforce record ID whose root folder ID you want to get.
Returns:
  • string returned is the Box folder ID of the root folder that was created.
  • If the root folder already existed, the value returned is the Box folder ID of the root folder that already existed.

createFolder

ParameterTypeDescription
folderNamestringName of the folder to be created. Folder names are subject to some restrictions.
parentFolderIdstringParent Box folder this folder will be created in.
accessTokenstringOptional - If accessToken is sent, that value is used for the Box API call; otherwise, the default service account credentials are used.
Returns:
  • string returned is the Box folder ID of the folder that was created.
  • null is returned if a folder is not created. In this case, check mostRecentError for details.
Creates a shared link for a Box folder.
ParameterTypeRequiredDescription
folderIdstringYesThe Box folder ID to create a shared link for.
Returns:
  • string returned is the shared link URL.
  • null if the shared link is not created. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • It creates the shared link with the default Box permissions.
  • Check mostRecentError when the method returns null.

getFolderContents

Retrieves files and subfolders from a Box folder.
ParameterTypeRequiredDescription
folderIdstringYesThe Box folder ID to retrieve contents from.
accessTokenstringNoIf accessToken is sent, that value is used for the Box API call. Otherwise, the default service account credentials are used.
Returns:
  • FolderContents object containing the files and folders in the Box folder.
  • If the request fails, the returned FolderContents object can include a status value. Check mostRecentError for details.
Usage notes:
  • If accessToken is blank or null, the method uses service account credentials.
  • The response can include both files and subfolders.
  • Check the returned FolderContents object’s status value for operation errors.
  • Check mostRecentError if the operation fails.

createFolderForRecordId

ParameterTypeDescription
recordIdidSalesforce record ID that a Box folder will be created for.
folderNameOverridestringBy default, the record’s name will be the folder name. If you want to name it something else, send that value here.
optCreateRootFolderbooleanBoolean to indicate whether to create the object root folder if it doesn’t exist. If false is sent and the root folder does not exist, the call will fail.
Returns:
  • string returned is the Box folder ID of the folder that was created.
  • null is returned if a folder is not created. In this case, check mostRecentError for details.
  • If the Salesforce record was already associated with a Box folder, the existing Box folder ID is returned.

moveFolder

ParameterTypeDescription
folderIdstringBox folder ID of the folder to be moved.
newParentFolderIdstringBox folder ID of the folder that will be the new parent folder.
accessTokenstringOptional - If accessToken is sent, that value is used for the Box API call. Otherwise, the default service account credentials are used.
Returns:
  • true if the folder was moved successfully.
  • false if the folder was not moved successfully. Check mostRecentError for details.

getUrlForFolder

ParameterTypeDescription
recordIdidID of the record.
Returns:
  • pageReference object with provided URL.
  • null if the parameters are incorrect.

createFolderForRecordIdFromTemplate

ParameterTypeDescription
recordIdidSalesforce record ID.
templateFolderIdstringSource folder which should be the template.
folderNameOverridestringName override of the new folder.
optCreateRootFolderbooleanFlag that determines if a root folder is created if it doesn’t exist.
Returns:
  • Newly created folder ID.
  • null if the parameters are incorrect.

Folder Association Methods

getFolderAssociationsByRecordId

ParameterTypeDescription
recordIdidSalesforce record ID that the folder mapping entries returned are related to.
Returns:
  • List returned is a collection of all folder mapping entries associated with this record.
  • Generally, it will be an empty list if no folder mapping entries exist, but under some circumstances, it could be null.

getFolderIdByRecordId

ParameterTypeDescription
recordIdidSalesforce record ID whose folder ID you want to get.
Returns:
  • string returned is the Box folder ID associated with the Salesforce record ID passed in.

getFolderIdsByRecordIds

Retrieves Box folder IDs associated with one or more Salesforce record IDs.
ParameterTypeRequiredDescription
recordIdsList<Id>YesSalesforce record IDs to look up.
Returns:
  • Map<Id, String> where each key is a Salesforce record ID and each value is the associated Box folder ID.
  • An empty map if no folder associations exist.
Usage notes:
  • This method queries Salesforce folder associations and does not call the Box API.
  • It queries the Record_ID_Indexed__c field on the FRUP__c object.
  • It returns only associations where Box_Folder_ID__c has a value.
  • Use this method to look up multiple record-to-folder associations in one call.

getRecordIdByFolderId

ParameterTypeDescription
folderIdstringBox folder ID.
Returns:
  • id returned is the Salesforce record ID associated with the Box folder ID passed in.

createFolderAssociation

ParameterTypeDescription
recordIdidSalesforce record ID that is being associated with a Box folder.
folderIdstringBox folder ID being associated with a Salesforce record.
Returns:
  • box__FRUP__c object - The FRUP object returned will be null if there was an error (check mostRecentError). Upon calling the commitChanges method, this FRUP entry will be inserted into the database. This method ensures consistency with other folder associations by not allowing the same folder to be associated with multiple records or vice versa.

Collaboration Methods

Collaborations created by the Box for Salesforce Developer Toolkit will not send collaboration emails to collaborators. Only the service account used for the Box for Salesforce integration will receive a collaboration email.

createCollaboration

ParameterTypeDescription
folderIdstringBox folder ID to create a collaboration on.
boxUserIdstringBox user ID to be collaborated (either boxUserId or emailAddress is required, but not both).
emailAddressstringEmail address of the Box user to be collaborated.
collabTypebox.Toolkit.CollaborationTypeType of collaboration (see the CollaborationType enum definition).
accessTokenstringOptional - If sent, this value is used for authentication for the Box API call; if null, the service account credentials are used.
Returns:
  • string returned is the ID of the Box collaboration that was created.
  • null returned if there was an error. In this case, check mostRecentError.

createCollaborationOnRecord

ParameterTypeDescription
userIdidSalesforce user ID to be collaborated.
recordIdidSalesforce record ID of the record folder to be collaborated on.
collabTypebox.Toolkit.CollaborationTypeType of collaboration (see the CollaborationType enum definition).
optCreateFolderbooleanBoolean to indicate whether to create the Box folder associated with the Salesforce record ID if it does not already exist. This also creates the root folder if it did not already exist. If set to false and the folder does not already exist, the call will fail.
Returns:
  • string returned is the ID of the Box collaboration that was created.
  • null returned if there was an error. In this case, check mostRecentError.

editCollaboration

ParameterTypeDescription
collabIdstringCollaboration ID.
collabTypeenumBox.Toolkit.CollaborationType enum.
accessTokenstringOptional - If sent, this value is used for the Box API call; if null, the service account credentials are used.
Returns:
  • Boolean based on the transaction success.
  • false if the parameters are incorrect.

deleteCollaboration

ParameterTypeDescription
collabIdstringCollaboration ID.
accessTokenstringOptional - If sent, this value is used for the Box API call; if null, the service account credentials are used.
Returns:
  • Boolean based on the transaction success.
  • false if the parameters are incorrect.

Search and Discovery

Searches Box content accessible to the service account.
ParameterTypeRequiredDescription
querystringYesThe search query string.
Returns:
  • SearchResults object with matching files and folders.
  • null if the search fails. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • It searches file names, descriptions, and content accessible to the service account.
  • Box returns up to 100 results by default.
  • Use search with filters when you need pagination or narrower search scope.
  • Check mostRecentError when the method returns null.

search with filters

Searches Box content with filtering, pagination, and scope controls.
ParameterTypeRequiredDescription
querystringYesThe search query string.
scopestringNoSearch scope, such as user_content or enterprise_content.
trashContentstringNoTrash filter, such as trashed_only or non_trashed_only.
limitintegerNoNumber of results to return. The Box API maximum is 200.
offsetintegerNoStarting position for pagination.
ancestorFolderIdsList<String>NoBox folder IDs to restrict the search to.
contentTypesstringNoContent type filter, such as name, description, or tags.
Returns:
  • SearchResults object with matching files and folders.
  • null if the search fails. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • Use scope to choose between user content and enterprise content.
  • The Box API supports up to 200 results per request.
  • Use offset to paginate through larger result sets.
  • Use ancestorFolderIds to limit results to specific folder hierarchies.
  • Check mostRecentError when the method returns null.

getRecentInteractions

Retrieves files and folders recently interacted with by the current user. Parameters:
  • None
Returns:
  • RecentItems object containing recently accessed content.
  • null if the request fails. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • Results are returned in order of most recent interaction.
  • Interactions can include actions such as opening, previewing, downloading, or editing an item.
  • Box limits the response to the API default, typically 100 items.
  • Check mostRecentError when the method returns null.

Enterprise Events

getEnterpriseEvents

Retrieves enterprise events for auditing and monitoring Box activity.
ParameterTypeRequiredDescription
streamTypestringYesStream type, such as admin_logs or admin_logs_streaming.
limitintegerNoNumber of events to return. The Box API maximum is 500.
streamPositionstringNoStream position marker for pagination or polling.
eventTypesList<String>NoEvent types to include, such as ITEM_UPLOAD or ITEM_DOWNLOAD.
createdAfterstringNoISO 8601 timestamp for events created after this time.
createdBeforestringNoISO 8601 timestamp for events created before this time.
Returns:
  • EnterpriseEvents object with event entries and the next stream position.
  • null if the request fails. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication and requires enterprise admin privileges.
  • Use the streamPosition from the previous response to continue polling the event stream.
  • The Box API supports up to 500 events per request.
  • Date filters must use ISO 8601 format, such as YYYY-MM-DDTHH:MM:SSZ.
  • Check mostRecentError when the method returns null.

Metadata

Check the toolkit.mostRecentError value for detailed error responses for all the methods.

getMetadataTemplateByName

Retrieves a metadata template definition by name and scope.
ParameterTypeRequiredDescription
templateNamestringYesThe name of the metadata template.
scopestringYesThe scope of the metadata template. Value is one of [global, enterprise].
Returns:
  • MetadataTemplate object with the template definition.
  • null if the template is not retrieved. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • Use it to inspect or validate a metadata template before creating or updating metadata values.
  • Check mostRecentError when the method returns null.

getBoxMetadataByFileId

This method calls the .
ParameterTypeRequiredDescription
fileIdstringYesThe ID of the Box file for which you want to retrieve metadata.
scopestringYesThe scope of the metadata template. Value is one of [global, enterprise].
templatestringYesThe name of the metadata template.
Returns:
  • Metadata object with the metadata key/value pairs.
  • null if the metadata is not retrieved. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • The request returns an error if the metadata instance does not exist on the file.
  • Check mostRecentError when the method returns null.

createBoxMetadataByFileId

This method calls the .
ParameterTypeRequiredDescription
fileIdstringYesThe ID of the Box file for which you want to create metadata.
scopestringYesThe scope of the metadata template. Value is one of [global, enterprise].
templatestringYesThe name of the metadata template.
metadataValuesMap<String, Object>YesKey/value pairs that match fields in the metadata template.
Returns:
  • Metadata object with the created metadata values.
  • null if the metadata is not created. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • The method fails if metadata already exists for the specified file, scope, and template. Use updateBoxMetadataByFileId to modify existing metadata.
  • Metadata keys must match the template field names.
  • Check mostRecentError when the method returns null.

updateBoxMetadataByFileId

This method calls the .
ParameterTypeRequiredDescription
fileIdstringYesThe ID of the Box file for which you want to update metadata.
scopestringYesThe scope of the metadata template. Value is one of [global, enterprise].
templatestringYesThe name of the metadata template.
operationsList<Map<String, Object>>YesJSON Patch operations. Each operation includes values such as op, path, and value.
Returns:
  • Metadata object with the updated metadata values.
  • null if the metadata is not updated. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • The operations parameter uses JSON Patch format.
  • Each operation should include an op, path, and, when required by the operation, a value.
  • Supported operations include add, replace, remove, and test.
  • Check mostRecentError when the method returns null.

deleteBoxMetadataByFileId

This method calls the .
ParameterTypeRequiredDescription
fileIdstringYesThe ID of the Box file for which you want to delete metadata.
scopestringYesThe scope of the metadata template. Value is one of [global, enterprise].
templatestringYesThe name of the metadata template.
Returns:
  • Boolean based on the transaction success.
  • false if the metadata is not deleted. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • It deletes the metadata instance from the file. It does not delete the metadata template.
  • Check mostRecentError when the method returns false.

getBoxMetadataByFolderId

This method calls the .
ParameterTypeDescription
folderIdstringThe ID of the Box folder for which you want to retrieve metadata.
scopestringThe scope of the metadata template. Value is one of [global, enterprise].
template_keystringThe name of the metadata template.
Returns:
  • FolderMetadata record associated with this folder, scope, and template key. You can find the custom values in keyValuePairs variable of this object.
  • null, if:
    • the parameters are incorrect,
    • access to the folder is missing,
    • metadata cascade policy is not found.

createBoxMetadataByFolderId

This method calls the endpoint.
ParameterTypeDescription
folderIdstringID of the Box folder for which you want to create metadata.
scopestringScope of the metadata template. Value is one of [global, enterprise].
template_keystringName of the metadata template.
keyValuePairsList<KeyValuePair>This class works as a map. Provide key/value pairs as a list, for the attributes to send to Box Metadata. The key/value mappings follow the same pattern as the . Number types such as '3000' and multi-select values such as 'Customer;Order' are represented as string inputs in the value field, as regular metadata values seen in the code samples.
Returns:
  • Newly created FolderMetadata object.
  • null, if:
    • the parameters are incorrect,
    • access to the folder is missing,
    • metadata cascade policy is not found.

updateBoxMetadataByFolderId

Calls the endpoint.
ParameterTypeDescription
folderIdstringID of the Box folder for which you want to update metadata.
scopestringThe scope of the metadata template. Value is one of [global, enterprise]
template_keystringThe name of the metadata template.
mdUpdatesList<FolderMetadataUpdate>Metadata updates. Provide the operation, path, and value. The metadata update records follow the same pattern as the . Number types such as 3000 and multi-select values such as Customer;Order are represented as string inputs in the value field, just as the regular metadata values in the code samples.
Returns:
  • Updated FolderMetadata object.
  • null, if:
    • the parameters are incorrect,
    • access to the folder is missing,
    • metadata cascade policy is not found.

deleteBoxMetadataFolderId

This method calls the endpoint.
ParameterTypeDescription
folderIdstringID of the Box folder for which you want to delete metadata.
scopestringThe scope of the metadata template. Value is one of [global, enterprise]
template_keystringThe name of the metadata template.
Returns:
  • Boolean based on the transaction success.
  • false is returned if the parameters are incorrect or the metadata is not found.

getMetadataCascadePolicyById

This method calls the endpoint. As it requires an ID, you need to call the getMetadataCascadePoliciesByFolderId method first.
ParameterTypeDescription
policyIdstringThe ID of the cascade policy you want to retrieve.
Returns:
  • MetadataCascadePolicy object retrieved from Box.
  • null, if:
    • the parameters are incorrect,
    • access to the folder is missing,
    • metadata cascade policy is not found.

getMetadataCascadePoliciesByFolderId

This method retrieves the cascade policies by providing a folder ID and calling the endpoint.
ParameterTypeDescriptionRequired
folderIdstringSpecifies for which folder to return the policies. This can’t be used on the root folder with ID 0.Yes
paginationMarkerstringDefines the position marker at which to begin returning results. This is used for marker-based pagination.No
offsetintegerThe offset of the item at which to begin the response.No
ownerEnterpriseIdstringEnterprise ID for which to find the metadata cascade policies. If not specified, it defaults to the current enterprise.No
Returns:
  • List of MetadataCascadePolicy objects retrieved from Box.
  • null, if:
    • the parameters are incorrect,
    • access to the folder is missing,
    • metadata cascade policy is not found.

createMetadataCascadePolicy

This method creates cascade policies by providing a Box folder ID, scope, template key, and by calling the endpoint.
ParameterTypeDescription
folderIdstringID of the Box folder for which you want to create the metadata cascade policy.
scopestringThe scope of the metadata cascade policy. Value is one of [global, enterprise]
template_keystringThe name of the template key.
Returns:
  • Newly generated MetadataCascadePolicy.
  • null, if:
    • the parameters are incorrect,
    • access to the folder is missing,
    • metadata cascade policy details are not found.

deleteMetadataCascadePolicy

This method deletes the cascade policies by providing a cascade policy ID and calling the endpoint.
ParameterTypeDescription
policyIdstringThe ID of the cascade policy you want to delete.
Returns:
  • Boolean based on the transaction success.
  • false is returned if parameters are incorrect, access to the folder is missing, or the metadata cascade policy is not found.

enableAppActivity

This method enables the given folder for App Activities by applying metadata on the folder and cascading it down.
ParameterTypeDescription
folderIdstringThe ID of the Box folder for which you want to enable App Activities.
Returns:
  • Boolean based on the transaction success.
  • false in case of incorrect parameters.

Salesforce and Slack

getIntegrationMappings

This toolkit method calls the endpoint to get the existing mappings.
ParameterTypeDescription
integrationStringSlack is currently the only supported value.
partnerItemIdStringID of the mapped item on the provided integration side. Example: a Slack channel ID.
Returns:
  • A list of IntegrationMapping objects.
  • null is returned if the parameters are incorrect, the access is missing, or the integration mapping is not found.

createIntegrationMapping

This toolkit method calls the endpoint to create the mappings.
When you map to a Slack channel, access_management_disabled is set to FALSE by default. This causes an automatic removal of collaborators that are not part of the Slack channel member list. Depending on how your organization sets up sharing in Box, we recommend that you either set access_management_disabled to TRUE by using the setSlackChannelAccessManagementDisabled method, or use groups. This ensures no users are removed, regardless of Slack settings. Collaborations are added or removed from Slack when a file is uploaded to a Slack channel.
ParameterTypeDescription
integrationStringSlack is currently the only supported value.
mappingIntegrationMappingApex defined type IntegrationMapping.
Returns:
  • Boolean based on the transaction success.

deleteIntegrationMapping

This toolkit method calls the endpoint to delete a mapping.
ParameterTypeDescription
integrationStringSlack is currently the only supported value.
integrationMappingIdStringRetrieved from getIntegrationMappings.
Returns:
  • Boolean based on the transaction success.

mapSfdcRecordToSlackChannel

This toolkit method uses the above integration mapping methods and provides a wrapper with four different use cases:
  1. If a mapping does not exist in Salesforce or Slack, it creates a folder under the Box for Salesforce folder structure, and an integration mapping to link it with the Slack channel.
  2. If a mapping only exists from Salesforce, it continues to use the folder and does not change the location. It creates an integration mapping to link it with the Slack channel.
  3. If a mapping only exists from Slack, it continues to use the folder and creates an FRUP record for the Salesforce record to use the existing folder. This folder is likely to be outside of the Salesforce root folder.
  4. If Salesforce and Slack have existing mappings but are not related to each other, it throws an error through Toolkit.mostRecentError or within a flow action, stating that the mappings already exist.
This method/invocable is used in a flow template provided in the Box for Salesforce package Create Box Folder/Slack Channel Mapping.
When you map to a Slack channel, access_management_disabled is set to FALSE by default. This causes an automatic removal of collaborators that are not part of the Slack channel member list. Depending on how your organization sets up sharing in Box, we recommend that you either set access_management_disabled to TRUE by using the setSlackChannelAccessManagementDisabled method, or use groups. This ensures no users are removed, regardless of Slack settings. Collaborations are added or removed from Slack when a file is uploaded to a Slack channel.
ParameterTypeDescription
recordIdIDSalesforce record ID.
slackChannelIdStringThe Slack channel ID.
slackWorkspaceOrOrgIdStringIf Box for Slack is installed org-wide, provide the Org ID (for example, E1234567) or the Workspace ID (for example, T5555555).
Returns:
  • Boolean based on the transaction success.

setSlackChannelAccessManagementDisabled

This toolkit method calls the endpoint to update the access management deactivated setting. This method/invocable is used in a flow template provided in the Box for Salesforce package Create Box Folder/Slack Channel Mapping.
ParameterTypeDescription
channelIdStringThe Slack channel ID.
disabledBooleanIndicates whether a channel member’s access to the underlying Box item is automatically managed. Depending on the type of the channel, access is managed through creating collaborations or shared links.
Returns:
  • Boolean based on the transaction success.

Box Sign

sendSignRequests

This method calls the endpoint to send documents for signature.
ParameterTypeDescription
requestsList<BoxSignRequest>List of Box Sign Request objects containing signers, files, and configuration for the signature request.
Returns: List of BoxSignResponse objects, one for each request processed. Each response contains the sign request ID, status, and any error information. BoxSignResponse returns error details, if:
  • the parameters are incorrect,
  • access to the files is missing,
  • file upload fails,
  • Box Sign API returns an error.

Document Generation

submitDocGenBatch

Submits a batch of documents to generate from a Box document generation template.
ParameterTypeRequiredDescription
templateFileIdstringYesThe Box file ID of the document generation template.
documentsList<Map<String, Object>>YesDocument configurations and merge data to use for generation.
Returns:
  • DocGenBatch object with the batch ID and status.
  • null if the batch is not submitted. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • Each document configuration should include the generated file name and the merge data for the template, such as fileName and data values.
  • Document generation runs asynchronously. Use getDocGenBatch to check the batch status.
  • Check mostRecentError when the method returns null.

getDocGenBatch

Retrieves the status and details of a document generation batch.
ParameterTypeRequiredDescription
batchIdstringYesThe batch ID returned from submitDocGenBatch.
Returns:
  • DocGenBatch object with the batch status and generated file details.
  • null if the batch is not retrieved. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • Poll this method periodically to monitor batch progress.
  • Batch statuses include pending, processing, completed, and failed.
  • Generated file details are available after the batch is complete.
  • Check mostRecentError when the method returns null.

File Requests

copyFileRequest

Creates a copy of an existing file request with customizable properties.
ParameterTypeRequiredDescription
fileRequestIdstringYesThe ID of the file request to copy.
folderIdstringYesThe destination Box folder ID for uploaded files.
titlestringNoCustom title for the new file request.
descriptionstringNoCustom description for the new file request.
statusstringNoFile request status, such as active or inactive.
isDescriptionRequiredbooleanNoWhether submitters must provide a description.
isEmailRequiredbooleanNoWhether submitters must provide an email address.
Returns:
  • FileRequest object with the new file request details.
  • null if the file request is not copied. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • If optional parameters are null, the new file request inherits those values from the source file request.
  • Use active to enable the copied file request immediately.
  • Check mostRecentError when the method returns null.

copyFileRequest with default settings

Creates a copy of an existing file request using the source file request settings and a new destination folder.
ParameterTypeRequiredDescription
fileRequestIdstringYesThe ID of the file request to copy.
folderIdstringYesThe destination Box folder ID for uploaded files.
Returns:
  • FileRequest object with the new file request details.
  • null if the file request is not copied. In this case, check mostRecentError.
Usage notes:
  • This method uses service account authentication.
  • The copied file request inherits settings from the source file request and uses the folder ID you provide.
  • Use this method when you only need to change the destination folder.
  • Check mostRecentError when the method returns null.

Box Hubs

Manage Box Hubs

getHubById

This method calls the endpoint to retrieve a specific hub.
ParameterTypeDescription
hubIdstringThe ID of the hub to retrieve.
Returns:
  • Hub object containing the hub details and metadata.
  • HubsToolkitException if:
    • the hub ID is blank or null,
    • access to the hub is missing,
    • the hub is not found.

getAllHubs

This method calls the endpoint to retrieve a list of all hubs.
ParameterTypeDescription
limitCountintegerOptional - maximum number of hubs to return.
markerstringOptional - pagination marker for retrieving additional results.
Returns:
  • HubsList object containing the list of hubs and pagination information.
  • HubsToolkitException if:
    • access to hubs is missing,
    • API request fails.

getEnterpriseHubs

This method calls the endpoint to retrieve enterprise-level hubs.
ParameterTypeDescription
limitCountintegerOptional - maximum number of hubs to return.
markerstringOptional - pagination marker for retrieving additional results.
Returns:
  • HubsList object containing the list of enterprise hubs and pagination information.
  • HubsToolkitException if:
    • access to enterprise hubs is missing,
    • API request fails.

createHub

This method calls the to create a new hub.
ParameterTypeDescription
titlestringRequired - title of the hub (maximum 50 characters).
descriptionstringOptional - description of the hub.
Returns:
  • Hub object containing the newly created hub details.
  • HubsToolkitException if:
    • the title is blank or null,
    • the title exceeds 50 characters,
    • access to create hubs is missing,
    • API request fails.

updateHub

This method calls the to modify an existing hub.
ParameterTypeDescription
hubIdstringRequired - the ID of the hub to update.
updateRequestHubUpdateRequestRequired - object containing the fields to update.
Returns:
  • Hub object containing the updated hub details.
  • HubsToolkitException if:
    • the hub ID is blank or null,
    • the update request is null,
    • the title exceeds 50 characters,
    • access to the hub is missing,
    • API request fails.

copyHub

This method calls the to create a copy of an existing hub.
ParameterTypeDescription
hubIdstringRequired - the ID of the hub to copy.
titlestringOptional - title for the copied hub (maximum 50 characters).
descriptionstringOptional - description for the copied hub.
Returns:
  • Hub object containing the newly created copied hub details.
  • HubsToolkitException if:
    • the hub ID is blank or null,
    • the title exceeds 50 characters,
    • access to the source hub is missing,
    • API request fails.

Box Hub Collaborations

createUserCollaboration

This method calls the endpoint to add a user to a hub.
ParameterTypeDescription
hubIdstringRequired - the ID of the hub.
userIdstringRequired - the ID of the user to add.
rolestringRequired - the role for the user in the hub.
Returns:
  • HubCollaboration object containing the collaboration details.
  • HubsToolkitException if:
    • the hub ID is blank or null,
    • the user ID is blank or null,
    • the role is blank or null,
    • access to the hub is missing,
    • API request fails.

createHubCollaboration

This method calls the endpoint to add a collaboration to a hub.
ParameterTypeDescription
requestHubCollaborationRequestRequired - object containing the collaboration details including hub reference and accessible by information.
Returns:
  • HubCollaboration object containing the collaboration details.
  • HubsToolkitException if:
    • the collaboration request is null,
    • the hub reference with ID is missing,
    • access to the hub is missing,
    • API request fails.

getHubCollaborations

This method calls the endpoint to retrieve collaborations for a hub.
ParameterTypeDescription
hubIdstringRequired - the ID of the hub.
limitCountintegerOptional - maximum number of collaborations to return.
markerstringOptional - pagination marker for retrieving additional results.
Returns:
  • HubCollaborationsList object containing the list of collaborations and pagination information.
  • HubsToolkitException if:
    • the hub ID is blank or null,
    • access to the hub is missing,
    • API request fails.

updateHubCollaboration

This method calls the endpoint to modify a collaboration.
ParameterTypeDescription
collaborationIdstringRequired - the ID of the collaboration to update.
rolestringRequired - the new role for the collaboration.
Returns:
  • HubCollaboration object containing the updated collaboration details.
  • HubsToolkitException if:
    • the collaboration ID is blank or null,
    • the role is blank or null,
    • access to the collaboration is missing,
    • API request fails.

Box Hub Items

addHubItem

This method calls the endpoint to add an item to a hub.
ParameterTypeDescription
hubIdstringRequired - the ID of the hub.
itemIdstringRequired - the ID of the item to add.
itemTypestringRequired - the type of the item (for example, file or folder).
Returns:
  • HubItemsManageResponse object containing the result of the item management operation.
  • HubsToolkitException if:
    • the hub ID is blank or null,
    • the item ID is blank or null,
    • the item type is blank or null,
    • access to the hub is missing,
    • API request fails.

Debugging

setEnhancedDebugging

Enables or disables enhanced debug logging for the current Toolkit instance.
ParameterTypeRequiredDescription
enabledbooleanYestrue to enable enhanced debugging; false to disable.
Returns:
  • Void
Usage notes:
  • Enhanced debugging applies only to the current Toolkit instance.
  • When enabled, enhanced debugging logs additional HTTP request and response details.
  • Use enhanced debugging for troubleshooting, and disable it in production to avoid unnecessary logging.
  • The setting does not persist across transactions.

isEnhancedDebuggingEnabled

Checks whether enhanced debugging is enabled for the current Toolkit instance. Parameters:
  • None
Returns:
  • true if enhanced debugging is enabled.
  • false if enhanced debugging is disabled.
Usage notes:
  • This method has no side effects.
  • Use it to conditionally run debug-only logic.
  • The returned value reflects the setting applied by setEnhancedDebugging.
Last modified on July 3, 2026