Skip to main content
Question

Couldn't create record-folder due to error: Unable to get the Salesforce root folder. Has the root folder been set in Box Settings?

  • May 23, 2025
  • 5 replies
  • 41 views

Forum|alt.badge.img

Hi,

The test class is failing due to code coverage error when deploying to production and giving me the "Couldn't create record-folder due to error: Unable to get the Salesforce root folder.  Has the root folder been set in Box Settings?" error, the test has 95% code coverage, not sure why it is failing while deploying. 

5 replies

Forum|alt.badge.img

Did you follow these instructions to properly set up the Box integration with Salesforce? 

https://support.box.com/hc/en-us/articles/360044195713-Installing-and-Configuring-Box-For-Salesforce

Alex, Box Developer Advocate


Forum|alt.badge.img

Hi Alex,

Yes, we are using Box since Nov 2021 the code runs fine in Production, only problem with the test class deployment , the test class runs fine in Full Copy and has a good amount of code coverage.not sure why it is saying couldn't find root folder.


Forum|alt.badge.img

I have a few changes in the code, which I am trying to deploying where I am seeing this error.

Thanks,

Kavitha.


Forum|alt.badge.img

Can you share the code that is causing the error? 

Alex


Forum|alt.badge.img

Hi Alex,

String accountId = String.valueOf( accRecord.Id );

            String recordFolderId = boxToolkit.createFolderForRecordId( accountId, null, true );

            if(recordFolderId == null) {

                System.debug('Couldn\'t create record-folder due to error: ' + boxToolkit.mostRecentError);

            }

when running test in production recordFolderId is returning null and giving the "Couldn't create record-folder due to error: Unable to get the Salesforce root folder. Has the root folder been set in Box Settings?" this error, I checked the folder settings in production and there is a root folder.