Box Integration

The following is code based on some suggestions on this community (thanks to all). We are using a custom Object called Service_Type__c and the Model is Service. I get the page to display in a tab, but the authentication error shows and even when putting in my credentials, it fails. Anything stand out?









&email_recipients=&debug=0" width="100%" height="800" scrolling="true" id="theIframe"/>

Try this instead — the two $Api merges were incorrect, I fixed them according to the syntax documented here in the Global Merge Variables / functions API docs.

Thanks but same result with the following code. Changed a bad reference to Model.Account to Model.Service, but no change. I get the authentication page and can’t login.

Do you have a running user model?  This line  {{$}}  is looking for information about the current user.  It provides the user information necessary for authentication.  If you don’t want to build a model, you could also use global merge syntax to get this information about the user,  rather than creating a model and referring to it.  Look at the document Zach provided for that syntax. 

We created a Model called RunningUser and pointed to the User Object, It has 4 fields, ID, First Name, Last Name and Email address. It has a condition of the User records of the User Id is the User Id of the user running this page and alway on. 

Ben, {{{$Api.Session_ID}}}needs to have a lowercase d: {{{$Api.Session_Id}}}

Also, the first part of the URL looks suspect to me: "{{{$Api.Partner_Server_Urls…

Maybe it’s correct, but would you mind posting where you found this code / iframe embed link?

Thanks. It is the VF page for the box element:
<apex:page standardController=“Service_Type__c”>

<apex:stylesheet value="{!$Resource.box__BoxFilesCSS}" /> <apex:iframe src="{!URLENCODE($Api.Partner_Server_URL_120)}%22%2C%22session_id%22%3A%22{!URLENCODE($Api.Session_ID)}%22%7D&amp;salesforce_object_typed_id={!$CurrentPage.parameters.Id}&amp;partner_object_type=Account&amp;partner_object_name={!URLENCODE(}&amp;partner_object_email=&amp;partner_object_id={!$CurrentPage.parameters.Id}&amp;open_new_window=1&amp;partner_user_id={!URLENCODE($User.Id)}&amp;partner_user_name={!URLENCODE($User.FirstName)}%20{!URLENCODE($User.LastName)}&amp;partner_user_email={!URLENCODE($User.Email)}&amp;email_recipients=&amp;debug=0" width="100%" height="800" scrolling="true" id="theIframe"/> </apex:page> Just sort of modified what we posted based on comments in the forum.

Thanks for posting the code. This is a usually just a big exercize in replacing merge statements. 

After taking apart the query strings here are all the merge statements and the equivalent Skuid Merge statement.  

  • {!URLENCODE($Api.Partner_Server_URL_120)} = {{#urlEncode}}{{$Api.Enterprise_Server_Urls.120}}{{/urlEncode}}

  • {!URLENCODE($Api.Session_ID)} = {{#urlEncode}}{{$Api.Session_Id}}{{/urlEncode}}

  • {!$CurrentPage.parameters.Id} = {{$}}    (This depends on a URL Param named “id” being passed into the page.)

  • {!URLENCODE(}  = {{#urlEncode}}{{$}}{{/urlEncode}}  (This depends on a model with the Name “ServiceType” and the field “Name” being present on the page) 

  • {!URLENCODE($User.Id)} = {{#urlEncode}}{{$User.userId}}{{/urlEncode}}

  • {!URLENCODE($User.FirstName)}  = {{#urlEncode}}{{$User.firstName}}{{/urlEncode}}

  • {!URLENCODE($User.LastName)} = {{#urlEncode}}{{$User.lastName}}{{/urlEncode}}

  • {!URLENCODE($User.Email)} = {{#urlEncode}}{{$}}{{/urlEncode}}

After all that replacement,  here is the resulting iFrame code: 

iFrame src="<a target="_blank" rel="nofollow" href=""><br></a>?token=%7B%22server_url%22%3A%22{{#urlEncode}}{{$Api.Enterprise_Server_Urls.120}}{{/urlEncode}}%22%2C%22session_id%22%3A%22{{#urlEncode}}{{$Api.Session_Id}}{{/urlEncode}}%22%7D<br>&amp;salesforce_object_typed_id={!$CurrentPage.parameters.Id}<br>&amp;partner_object_type=Account&amp;partner_object_name={{#urlEncode}}{{$}}{{/urlEncode}}<br>&amp;partner_object_email=<br>&amp;partner_object_id={{$}}<br>&amp;open_new_window=1<br>&amp;partner_user_id={{#urlEncode}}{{$User.userId}}{{/urlEncode}}<br>&amp;partner_user_name={{#urlEncode}}{{$User.firstName}}{{/urlEncode}}%20{{#urlEncode}}{{$User.lastName}}{{/urlEncode}}<br>&amp;partner_user_email={{#urlEncode}}{{$}}{{/urlEncode}}<br>&amp;email_recipients=<br>&amp;debug=0" &nbsp;<br>width="100%" height="800" scrolling="true" id="theIframe"

Hopefully this works for you. 


Thanks and we have tried this with no luck. We have a Model defined called “Service” and the Name field is called Service__c, under the model which is the “Service” field on the Service_Type__c object (i.e. Service__c). As for the, not sure where that would be set as box uses the ID of the record it is on to display the folder/files of the related object. 
When this code loads in the skuid UI, we are getting the authentication dialog, so we are not getting past the authentication and so not sure we can even see if the rest of the params are correct. Truly appreciate the effort.

Ok.  Let’s debug… 

Go to the rendered page.  Select the BOX.Com section of the page and right click and “Inspect Element” 

Find the iframe code and copy what is there.   Here is a picture from another third party integration. 

I ususally paste the iFrame code into a text editor and compare it with the code I put into the Skuid Template to ensure that all the merge fields are getting correctly the expected data. 

When I see Id’s that are mysterious.  I plug them into a salesforce url   ( )

This should show you what data is not getting pulled into your Box integration. 











&amp;debug=0" width="100%" height="800" scrolling="true" id="theIframe">

Ooh I see two things. 

1. Look at this line: 


You say above "box uses the ID of the record it is on to display the folder/files of the related object. " 

If you are building a detail page for “Service_Type_c” records,  you probably have a condition on “Service” model that filters down records to one ID.  Usually this is done with a URL parameter.  Whatever this parameter is,  can be re-used here.   If the URL parameter is “Id”  your line needs to read: 


2. Look at this line. 


For whatever reason,  no data is getting populated there.  You said: “We have a Model defined called “Service” and the Name field is called Service__c, under the model which is the “Service” field on the Service_Type__c object (i.e. Service__c).”   If this is the case, the merge syntax needs to be:  “{{$}}”  

The rest looks correct. 

One sec, I think I had cached data. Checking again and will post results.

I did a comparison (sent via email) between what is being rendered and what works in our production environment.

Basically a couple things stand out.

First, the Api.Enterprise_Server_Url.120 is not being set on the Skuid object. 

{!URLENCODE($Api.Partner_Server_URL_120)} is what Box is using in the current VF page and {{$Api.Enterprise_Server_Urls.120}} is what you sent me to use.

Second, the Skuid object is using the 18 digit ID of the object and box using the 15 digit.

Third, I have the object type wrong in Skuid.

{{$Api.Partner_Server_Urls.12}} should be used in Skuid, not {{$Api.Enterprise_Server_Urls.120}} (remove the zero at the end), and use Partner instead of Enterprise.

More than likely the “Skuid object” that you need to pass in to Box is the first row in a Model in your page. Say that the object record is your Service model (I don’t know if this is true), then you can get the 15-digit Id of this record by doing this:


Well after all the input provided, using pieces of each, and much trial and error, we have it working on a custom object. I am going to try and use this same code on another custom object that is a little different and then will send you a pdf of the steps I took and details of how we all got this working, for future reference.
Much appreciated.

WOOT!  Sorry for the trials and tribulations.  We appreciate your patience. 

Thanks for this post - it has been very helpful. I was able to embed Box within a Skuid tab for the Opportunity object, however, if there is an associated box folder already created it will not show when the tab loads. Instead, it prompts you to create a new folder to associate with the salesforce record.

I’m assuming it has something to do the with folder ID on the box side of things? Does anyone know how to grab an existing salesforce-box folder for a specific record?


If your setup is accurate (the setup of the SKUID TEMPLATE), then you should see the associated folder, if one existed already. If you are not seeing the folder then your variables are not correct. For instance, our environment has a root folder of SF, and a specific service object 1209298 has a box folder created with 3 pdf’s. The SKUID template needs to be able to read the ID of the object 1209298. If you inspect the page and find the template url, you should see a variable called partner_object_Id= followed by the id (found in the sf url) of the object that has the attachments. If this field is blank, then the variable is not being passed. If the field has a value, then something else is not setup correctly. In the Box “Menu Bar” you should also see the path to at least the root folder, and if not then something else could be wrong as well, but I would guess it is the Object Id.

Hi Ben,

Thank you for the help and quick response! Using your logic to hunt down the issue, I found that changing {{$Param.Id15}} to {{$}} (even though the Opp is the param id) allowed the information to flow into the partner_object_Id. I don’t understand why, but it worked!

Thanks again.