Skip to content

Instantly share code, notes, and snippets.

View sakthivelsfdc's full-sized avatar

Sakthivel Madesh sakthivelsfdc

View GitHub Profile
@sakthivelsfdc
sakthivelsfdc / contactUpdateFromScheduleClassTest.cls
Last active March 2, 2020 11:06
contactUpdateFromScheduleClassTest.cls
@isTest
public class contactUpdateFromScheduleClassTest {
@isTest static void contactUpdateTest_Schedule() {
Contact cont = new Contact(FirstName ='First Name', LastName ='Last Name', Email='sakthi@theblogreaders.com');
insert cont;
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
String CRON_EXP = '0 6 * * * ?';
String yourFilesContent = 'TheBlogReaders.com File upload content';
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S'; // to use S specify this document is in Salesforce, to use E for external files
conVer.PathOnClient = 'testing.txt'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = 'Testing Files'; // Display name of the files
conVer.VersionData = EncodingUtil.base64Decode(yourFilesContent); // converting your binary string to Blog
insert conVer; //Insert ContentVersion