SalesForce dev toolkit - How to associate record with Box Folder
Hello,
We are using SalesForce and Box in and we need to implement an integration that whenever a new account is created in SalesForce a matching folder will be created in BOX and will be associated with the Salesforce account record so when user will open the Account record he can see the account files on BOX.
We have setup the SalesForce BOX integration and it is working perfect.
We also managed to create the folder in BOX when new account is created in SFDC (using the devloper toolkit provided by BOX that is being called in a trigger after account is created).
But for some reason the association of the SFDC folder and the BOX folder is not happening althoug our code is copy/paste of the code provided by BOX.
Here is the code we are using to create the folder. The code is called from the Account After Insert trigger:
Any help with solving the association issue will be appreciated
Thanks,
Koby
-
Hi Koby,
Thanks for posting this question. Can you please provide a little bit more information about where the folder actually gets created at in Box / and desired folder structure?
The default integration automatically creates a folder with the name of the Account ("ACME") as a sub folder within the Salesforce-Org --> Accounts directory:
"But for some reason the association of the SFDC folder and the BOX folder is not happening althoug our code is copy/paste of the code provided by BOX."
-
Hi,
Thanks for the reply. You stated in your answer that the default integration automatically creates a folder for the account with the name of the account.
This is true but it is not automatic - You have to go into the account page and click the "Create account folder" button in the Box Section.
I am trying to create the folder automatically when the account is created. For that I wrote an Apex Trigger that fires after the account has been created and I am calling to the code that creates the BOX folder and associate it with the account. The solution was taken from the follwoing article: https://community.box.com/t5/Integrations/Box-For-Salesforce-Developer-Toolkit/ta-p/689#code
Koby
-
Hey Joshua,
I'll try taking a stab here. There's a couple avenues you can go down to automatically create folder for accounts/opportunities upon visiting that record.
1.) This should be native to the integration but if you were to navigate to Box Settings Tab inside your Salesforce account, you should
come across an option called 'Auto-Collab', make sure that is enabled. This allows the person visiting the Salesforce record to automatically
get collaborated into the record and create a Box folder in their account.
2.) If you want to fire this creation from a trigger, what you could do is set up a trigger on opportunity/account creation and have that trigger
pass in a list of Salesforce record Id's you would want to create Box folders for. You would then use the method 'createFolderforRecordId'
from the Box for Salesforce Developer Toolkit to create the Box folder for the Salesforce Record. Seen here:
https://developer.box.com/v2.0/docs/box-for-salesforce-developer-toolkit
I believe there is an example on how to use it as well in the code block towards the bottom of the page.
Hope this helps!
-
The sample code covers creating a single folder. How does the toolkit handle mass creations? So if an after insert trigger in Salesforce executes, are there any accommodations to be made for iterating over each account that gets inserted and using the createFolderForRecordId method?
Please sign in to leave a comment.
Comments
5 comments