I have the Box.com salesforce integration package installed in SalesForce. The integration package includes a visualforce widget which you can add to record page layouts that acts as a box.com based file browser. When you upload files using the widget, it creates a folder inside a special "SalesForce" folder in box that is associated with that record. Every record that has files attached to it on the box has it's own folder under /SalesForce/.
I have two objects in SalesForce that work closely together: Campaigns and Opportunities. By default, the box integration package does not support the campaigns object, so I created a custom visualforce page called CampaignFiles based on the built-in AccountFiles page that comes with the package. This works just fine for the campaigns object. However, because my opportunities are associated with campaigns, I would like for files uploaded to opportunity records to go into a subfolder under the associated campaign record's folder. Basically, I just want each of my opportunity records to have a subfolder in their associated campaign record's folder.
As an example, let's say I have a Campaign record called "Test Campaign" and I have a related opportunity record called "Test Opportunity". The opportunity record references the campaign record using a lookup field. By default, if I upload some files to both records, they will be uploaded to the following folders on box:
"Test campaign" files are uploaded to /SalesForce/Test campaign/
"Test Opportunity" files are uploaded /SalesForce/Test Opportunity/
Since "Test Opportunity" looks up the "Test Campaign" record, I would like these to be uploaded like this instead:
"Test campaign" files to /SalesForce/Test campaign/
"Test Opportunity" files to /SalesForce/Test campaign/Test opportunity/
Is there a way to modify the apex code of the widget to do this? I assume there must be a way to fetch the value of the lookup field to get the name of the campaign record and upload to a subfolder under that campaign record's folder...
Thanks for taking the time to read & reply. I appreciate your help!