// Define the record
Customer_Interaction__b bo = new Customer_Interaction__b();
bo.Account__c = '001R000000302D3';
bo.Game_Platform__c = 'PC';
bo.Play_Date__c = DateTime.newInstance(2018, 2, 5);
bo.In_Game_Purchase__c = 'A12569';
bo.Level_Achieved__c = '45';
bo.Lives_This_Game__c = '3';
bo.Score_This_Game__c = '5500';
bo.Play_Duration__c = 25;
// Insert the record, which creates a new record
database.insertImmediate(bo);
// Define the record
Customer_Interaction__b bo = new Customer_Interaction__b();
bo.Account__c = '001R000000302D3';
bo.Game_Platform__c = 'PC';
bo.Play_Date__c = DateTime.newInstance(2018, 2, 5);
bo.In_Game_Purchase__c = 'A12569';
bo.Level_Achieved__c = '45';
bo.Lives_This_Game__c = '3';
bo.Score_This_Game__c = '5500';
bo.Play_Duration__c = 25;
// Modify a field in the index
bo.Game_Platform__c = 'Mac';
// Insert the record, creating a new record because the primary key has changed
database.insertImmediate(bo);
// Define the record
Customer_Interaction__b bo = new Customer_Interaction__b();
bo.Account__c = '001R000000302D3';
bo.Game_Platform__c = 'PC';
bo.Play_Date__c = DateTime.newInstance(2018, 2, 5);
bo.In_Game_Purchase__c = 'A12569';
bo.Level_Achieved__c = '45';
bo.Lives_This_Game__c = '3';
bo.Score_This_Game__c = '5500';
bo.Play_Duration__c = 25;
// Modify a field not included in the index
bo.Level_Achieved__c = '1';
// Insert the record, which updates the second record because the index is the same
database.insertImmediate(bo);
csv File
Play Start,In-Game Purchase,Level Achieved,Lives Used,Platform,Play Stop,Score,Account
2015-01-01T23:01:01Z,A12569,57,7,PC,2015-01-02T02:27:01Z,55736,001R000000302D3
2015-01-03T13:22:01Z,B78945,58,7,PC,2015-01-03T15:47:01Z,61209,001R000000302D3
2015-01-04T15:16:01Z,D12156,43,5,iOS,2015-01-04T16:55:01Z,36148,001R000000302D3