Box for Salesforce: Embedding in Object Records

Follow

·

Get Training

As part of the Box for Salesforce integration, you and your team can create, access, and share any Box content within a Salesforce object record via Box Embed.  Additional information about Box Embed is available in Box Embed Overview and FAQs.

Box Embed can be added in both standard (e.g. Leads, Opportunities, etc.) and custom Salesforce object records.  Additionally, Box Embed can be enabled for Salesforce1, Salesforce's mobile app.

 

Embedding Box in Standard Object Records

Use the following procedure for all Salesforce standard objects (e.g. Account, Lead, Contact, Opportunity, etc.) requiring a Box Embed addition as part of the page layout.

  1. Access the Salesforce Menu and click Setup (top right corner).
  2. From the left menu, navigate to Build > Customize to find the appropriate object (e.g., Lead, Opportunities, Accounts, or any Custom_Object).
  3. Expand the object's menu and select Page Layouts.
  4. Edit the Page Layout where Box Embed must be added.
  5. From the [Object] Layout > Field menu, drag a new Section into the Page Layout into the desired position. 
  6. Change the Section parameters:
    • Assign a name for the section (for example, Box Files).
    • Make the section 1-Column
    • Click OK
  7. Add the newly-created Visual Force Page to the Page Layout:
    • From the [Object] Layout menu, click Visualforce Pages.
    • Drag [object_name]BoxSection into your newly created Section.
    • Click the wrench on the top right corner of the [object_name]BoxSection Visualforce page.
    • Set the height to 600 pixels (minimum) for best viewing.
    • Save the page layout.

 

Embedding Box in Custom Object Records

  1. Log into Salesforce as a Salesforce Admin
  2. For an existing custom object (for example, Custom_Object), create a new custom field in Custom_Object.  See Salesforce instructions for more details.
    1. Select Text.
    2. In the Field Label box, type FolderID. In the Length box, type 18 as the maximum length for the text box.
    3. Select the required access level for this object and click Next.
    4. Click Save.
  3. Create a new Visual Force page for Custom_Object (see Salesforce instructions for creating Visual Force pages).
  4. Copy the following Visual Force page code and paste it in this new page.

    <apex:page standardController="Custom_Object__c" extensions="box.DisplayWidget" showheader="false" sidebar="false" action="{!GetLoginToken}">
    <apex:stylesheet value="{!URLFOR($Resource.box__BoxEmbed, 'BoxEmbed/style.css')}"/>
    <apex:iframe src="/apex/box__BOXSection?id={!Custom_Object__c.Id}&param=Custom_Object_Box_Section" rendered="{!DisplayBoxSection}"/>
    <apex:iframe src="{!folderShareLink}" rendered="{!DisplayBoxWidget}" width="100%" height="100%" frameborder="0" scrolling="NO"/>
    </apex:page>


    Note
    : Parameters marked in bold are variables. Change these parameters to match your enterprise setup. For example:
    - Custom_Object__c: Change this variable to the API name of your custom object.
    - Custom_Object__c.Id: Change this variable to the API name of your custom object ID field.
    - Custom_Object_Box_Section: Change this variable to the API name of your Visual Force page.

  5. Add this newly created section to the Custom Object Page Layout. See the Embedding Box in Standard Object Records section for more details.

 

Sample Code Snippet

This code snippet example is for a custom object with the API name "sales_request__c" with a Visualforce page named/labeledBoxLegalRequestFiles.

<apex:page standardController="sales_request__c" extensions="box.DisplayWidget" showheader="false" sidebar="false" action="{!GetLoginToken}">
<apex:stylesheet value="{!URLFOR($Resource.box__BoxEmbed, 'BoxEmbed/style.css')}"/>
<apex:iframe src="/apex/box__BOXSection?id={!sales_request__c.Id}&param=BoxLegalRequestFiles" rendered="{!DisplayBoxSection}"/>
<apex:iframe src="{!folderShareLink}" rendered="{!DisplayBoxWidget}" width="100%" height="100%" frameborder="0" scrolling="NO"/>
</apex:page>

 

Enabling Salesforce1 (Mobile)

To enable Box integrations for the Salesforce1 mobile application, follow this procedure:

  1. Access the Salesforce Menu and click Setup (top right corner).
  2. From the App Setup > Customize menu choose the object (for example, Lead, Opportunities, Accounts, or any Custom Object) to add the Box Embed interface.
  3. Click Edit to select the Object > Page Layouts where Salesforce1 must be added.
  4. Drag the MobileBoxSection into your Mobile Cards (Salesforce1 only) section.
  5. Set the height to 56 Pixels (minimum) for best viewing.
  6. Save the page layout.
Was this article helpful?
0 out of 0 found this helpful