Skip to content

Instantly share code, notes, and snippets.

View benahm's full-sized avatar
🎯
Focusing

Ahmed BENSAAD benahm

🎯
Focusing
  • Paris
View GitHub Profile
// Define the record
QuoteFieldHistory__b bo1 = new QuoteFieldHistory__b();
bo1.Field__c = 'Status';
bo1.Date__c = Date.today();
bo1.NewValue__c = 'In Review';
bo1.OldValue__c = 'Draft';
bo1.Quote__c = '0Q03N000000EnQaSAK';
bo1.User__c = '0053N000002EdVOQA0';
// Insert the record
List<Account> accList = TestDataFactory.createSObjectList('Account', new Map<String,Object>{
'Description' => 'Account Description'
},10);
List<Case> caseList = TestDataFactory.createSObjectList('Case', new Map<String,Object>{
'Account' => AccList,
'Contact.Account' => AccList
},10);
List<Account> accList = TestDataFactory.createSObjectList('Account', new Map<String,Object>{
'Name' => new List<String>{'Google','Amazon','Facebook','Apple','Microsoft'}
'Description' => 'Same description'
},5);
List<User> uList = TestDataFactory.createSObjectList('User', new Map<String,Object>{
'ProfileId' => UserInfo.getProfileId(),
'Username' => 'test{!index}@mytestdomain.developer',
'CommunityNickname' => 'test{!index}'
},10);
List<Contact> conList = TestDataFactory.createSObjectList('Contact',10);
User u = (User)TestDataFactory.createSObject('User', new Map<String,Object>{
'ProfileId' => UserInfo.getProfileId()
});
Contact con = (Contact)TestDataFactory.createSObject('Contact', new Map<String,Object>{
'Description' => 'Contact description',
'Account' => new Map<String,Object>{
'Name' => 'Account Name',
'Description' => 'Account Description'
}
});
Contact con = (Contact)TestDataFactory.createSObject('Contact', new Map<String,Object>{
'AccountId' => TestDataFactory.DEFAULT_VALUE
});
Contact con = (Contact)TestDataFactory.createSObject('Contact', new Map<String,Object>{
'Description' => TestDataFactory.DEFAULT_VALUE,
'Account.Phone' => TestDataFactory.DEFAULT_VALUE
});
Contact con = (Contact)TestDataFactory.createSObject('Contact', new Map<String,Object>{
'FirstName' => 'Doe',
'LastName' => 'John',
'Account.Description' => 'Description of the related account',
'Account.Parent.Name' => 'Name of the parent Account'
});