Hi @peifengyuan!
I think there are two potential ways to solve your problem:
- 
If you would like to continue to use an Apex trigger, you will need to use the createFolderForRecordId method call in a separate class. The Box Developer Toolkit leverages future callouts which is why you’re receiving this error. 
- 
Alternatively, you can leverage the Salesforce Flow invocable actions that we ship with the Box for Salesforce managed package: https://developer.box.com/guides/tooling/salesforce-toolkit/flow-actions/ 
     
                                    
            Hi  @kadams
Thank you so much!!
I will try it out right away. Have a great day!
Thank you & Best Regards,
peifeng yuan
                
     
                                    
            Hi @kadams
Sorry to disturb you again.
I tried separating the class and calling it from the trigger, but I still encountered the same error. Here is my code. Could you please tell me what is wrong with it?
BoxCommonUtil class
public class BoxCommonUtil {
    public BoxCommonUtil() {
    }
    public static void creatBoxFolderNew(Project__c [] newObjs) {
        System.debug('run create box folder');
        // IdList
        List<Id> projectIdList = new List<Id>();
        for(Project__c project : newObjs) {
            projectIdList.add(project.Id);
        }
        List<Project__c> boxProjectList = [SELECT Id,
                                                  Name,
                                                  PJ_ProjectKeyNo__c,                   
                                                  PJ_ProjectManagementDepartment__c,
                                                  FROM Project__c 
                                                  WHERE Id IN :projectIdList];
        // get Folder Details info
        Map<String, box__Folder_Details__c> bfdMap = box__Folder_Details__c.getAll();
        //Map<Folder Name, ForderId>
        Map<String, String> bfdNameIdMap = new Map<String, String>();
        for(box__Folder_Details__c bfd : bfdMap.values()) {
            bfdNameIdMap.put(bfd.box__Folder_Name__c, bfd.box__FolderId__c);
        }
        List<Project__c> updateProjectList = new List<Project__c>();
        box.Toolkit boxToolkit = new box.Toolkit();
        for(Project__c project : boxProjectList) {
            String folderNameOverride = project.PJ_ProjectKeyNo__c + '_' + project.Name;
            System.debug(folderNameOverride);
            System.debug(project.Id);
            String projectFolderId;
            try{
                // create box Folder
                projectFolderId = boxToolkit.createFolderForRecordId(project.Id, folderNameOverride, true);
                // get recent error
                System.debug(boxToolkit.mostRecentError);
            } catch(Exception e) {
                System.debug(e.getMessage());
            }
            // move folder
            String newParentFolderId = bfdNameIdMap.get(project.PJ_ProjectManagementDepartment__c);
            // run move folder
            Boolean isMoved = boxToolkit.moveFolder(projectFolderId, newParentFolderId, null);
            System.debug(isMoved);
            // 
            project.PJ_ProjectFolderId__c = projectFolderId;
            project.PJ_BoxLink__c = System.Label.CON_BOX_Url + projectFolderId;
            updateProjectList.add(project);
        }
        boxToolkit.commitChanges();
        update updateProjectList;
    }
}
Trigger Handler class
    public void onAfterInsert(Project__c [] newObjs, Map<ID, Project__c> newObjMap) {
        // Create Box Folder
        try {
            // creatBoxFolder(newObjs);
            BoxCommonUtil.creatBoxFolderNew(newObjs);
        } catch(Exception e) {
        }
        
    }
                
     
                                    
            Hi @kadams
The issue has been resolved! I forgot to include the @future annotation…
I made the following modifications to the source code.
thank you so much!!
BoxCommonUtil class
public class BoxCommonUtil {
public BoxCommonUtil() {
}
@future (callout=true)
// public static void creatBoxFolderNew(Project__c [] newObjs) {
public static void creatBoxFolderNew(List<ID> projectIdList) {