Sep 20, 2024
185 Views
Comments Off on Salesforce auto-create folders for all Account? Box.com
0 0

Salesforce auto-create folders for all Account? Box.com

Written by

This is batch class use to auto-create folder for account .

global class autofolderCreator implements Database.Batchable<sObject>,Database.Stateful,Database.AllowsCallouts{

global Map<String,String> boxFmap = new Map<String,String>();

global autofolderCreator(){ }

global Database.QueryLocator start(Database.BatchableContext BC){

// this loop use to map existing folder with account so prevent for duplication.

for(box__Folder_Meta__c mp :[select id,name,box__Folder_Id__c ,box__Folder_Name__c,box__Folder_Share_Link__c from box__Folder_Meta__c limit 9999]){

boxFmap.put(mp.box__Folder_Name__c,mp.id);

}

String query = ‘Select id,name from account’; return Database.getQueryLocator(query);

}

global void execute(Database.BatchableContext BC, List<Account> scope){

box.Toolkit boxToolkit ;

for(Account a : scope){

if(!boxFmap.containsKey(a.name)){

boxToolkit = new box.Toolkit(); String accountFolderId = boxToolkit.createFolderForRecordId(a.id, null, true);

boxToolkit.commitChanges();

}

}

}

global void finish(Database.BatchableContext BC){ }

}

Box.com,Auto create folder for account.

Article Categories:
Salesforce
Ramya Singh
https://thestarbiznews.com

Ramya Singh isn't your average tech blogger. Sure, she's got the brains to understand the latest algorithms and the jargon to explain them in plain English. But she's also got a twinkle in her eye and a way of weaving technology into the fabric of everyday life that makes it nothing short of fascinating. Whether she's reviewing the latest smartphone, exploring the potential of virtual reality, or delving into the ethical implications of artificial intelligence, Ramya does it with a contagious enthusiasm that makes you want to learn more, do more, and be a part of the exciting world of tech. So, if you're looking for a tech blog that's informative, inspiring, and just plain fun, follow Ramya Singh. She'll take you on a journey through the ever-evolving landscape of technology, and you might just find yourself a little bit more tech-savvy (and a lot more excited) along the way.