Append images to a Rich Text field using a Batch (Developer-Oriented)
public class myBatch implements Database.Batchable<sObject>, Database.Stateful {
public list<Account> acclist;
public myBatch(list<Account> acclist) {
this.acclist = acclist;
}
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator('select id from Account where Id IN :acclist');
}
public void execute(Database.BatchableContext bc, List<Account> scope){
sharinpix.SharinPixToRichTextAutomation.Params params = new sharinpix.SharinPixToRichTextAutomation.Params();
List<sharinpix.SharinPixToRichTextAutomation.Params> paramsList = new List<sharinpix.SharinPixToRichTextAutomation.Params>();
for(Account acc : scope) {
params.recordId = acc.Id;
params.imageUrlFieldApiName = 'sharinpix__ImageURLThumbnail__c';
params.columns = 4;
params.replaceContent = true;
params.richTextFieldApiName = 'MyRichTextField__c';
paramsList.add(params);
}
sharinpix.SharinPixToRichTextAutomation.appendToRichText(paramsList);
}
public void finish(Database.BatchableContext bc){}
}PreviousSalesforce Files Import and Export using SharinPix FeaturesNextSharinPix Mobile App: Retrieve User Information When Uploading Photos (Developer-Oriented)
Last updated
Was this helpful?

