+ Start a Discussion
AnonymouseAnonymouse 

VisualForce Page Error Argument Cannot Be Null

Hello,
I'm currently implementing a box.com (similar to dropbox or google drive) file upload setup with Salesforce. Fortunately, there's an app on AppExchange and some instructions on how to implement it in Salesforce.

The client says they want it on each object and custom object page layout. 

The box.com instructions have the following code (I replaced the generic object name with "Task" for this case):

The visualforce page name is: Task_Box_Section.vfp
<apex:page standardController="Task"
           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={!Task.Id}&param=Task_Box_Section"
             rendered="{!DisplayBoxSection}"/>
<apex:iframe src="{!folderShareLink}"
             rendered="{!DisplayBoxWidget}"
             width="100%"
             height="100%"
             frameborder="0"
             scrolling="NO"/>

</apex:page>
Do you see anything that I'm doing wrong ? It's supposed to show up a file upload section, but nothing shows up and there's an error instead.

"Argument cannot be null. An unexpected error has occurred. Your solution provider has been notified. (box)"

May you please assist?

Sincerely,
Jackie
Best Answer chosen by Anonymouse
KdKomalKdKomal
Hi Jackie,

Did you create the folderId field on the task object.

I followed the steps that were mentioned in the Guide and i got this page. Apparently i need to setup an account for the whole thing to get done but i guess the Argument Cannot Be Null is gone for me.

Here is the Code that i followed after i created the folderId field.
<apex:page standardController="Task" 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={!Task.Id}&param=TaskBox" rendered="{!DisplayBoxSection}"/> <apex:iframe src="{!folderShareLink}" rendered="{!DisplayBoxWidget}" width="100%" height="100%" frameborder="0" scrolling="NO"/> </apex:page>

Please note as i named my VF page as "TaskBox", i passed "param=TaskBox". 
User-added image

All Answers

KdKomalKdKomal
Hi Jackie,

I could not dive much into the detail but for standard objects(Task is a std. Object) they have mentioned just to create a section in page layout and add the VF page as per the std. object. i am not completely sure if it will be of any help but worth a try.

Please refer this link.
https://community.box.com/t5/How-to-Guides-for-Integrations/Box-For-Salesforce-User-Guide/ta-p/180#BfS_embedding
 
AnonymouseAnonymouse
Hi kd,

Thank you for your reply. I'm afraid I already tried that. I'm trying to do step #7:

7. Add the newly-created Visual Force Page to the Page Layout:
         1. From the Lead Layout menu, click Visualforce Pages.
         2. Drag [object_name]BoxSection into your newly created Section.
         3. Click the wrench on the [object_name]BoxSection Visualforce page.
         4. Set the height to 600 pixels (minimum) for best viewing.
         5. Save the page layout.

I'm getting errors when I try to do this.

Sincerely,
Jackie
 
Raj VakatiRaj Vakati
Can you see is there any error in your page controller? "Task_Box_Section" page and its controller 


Go to debug logs and see 
KdKomalKdKomal
Hi Jackie,

Did you create the folderId field on the task object.

I followed the steps that were mentioned in the Guide and i got this page. Apparently i need to setup an account for the whole thing to get done but i guess the Argument Cannot Be Null is gone for me.

Here is the Code that i followed after i created the folderId field.
<apex:page standardController="Task" 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={!Task.Id}&param=TaskBox" rendered="{!DisplayBoxSection}"/> <apex:iframe src="{!folderShareLink}" rendered="{!DisplayBoxWidget}" width="100%" height="100%" frameborder="0" scrolling="NO"/> </apex:page>

Please note as i named my VF page as "TaskBox", i passed "param=TaskBox". 
User-added image
This was selected as the best answer
KdKomalKdKomal
Hi Jackie,

Were you able to resolve the issue ?
AnonymouseAnonymouse
Hi Raj and Kd,

Thank you for all your assistance. Yes, I was able to resolve the issue. It turned out that the Box.com managed package did not have Visualforce pages for all of the standard default Salesforce objects. Fortunately, it turns out I will no longer need it for Tasks. So, I have skipped it for that object, but it looks like the assistance provided earlier works for the other objects. 

Sincerely,
Jackie