Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delete [select id from VOC__c];
- Integer surveysCount = 500;
- List<String> testUsers = new List<String> {
- '0057E000004dZGxQAM',
- '0057E000004dZGyQAM',
- '0057E000004dZGzQAM',
- UserInfo.getUserId()
- };
- List<String> businessUnits = new List<String> {
- 'Commerce',
- 'Corporate',
- 'App and Device Support'
- };
- List<String> contactChannels = new List<String> {
- 'Chat - Inbound',
- 'Email - Inbound',
- 'Messaging - Inbound',
- 'Voice - Inbound'
- };
- List<VOC__c> surveys = new List<VOC__c>();
- List<DateTime> surveyDates = new List<DateTime> {
- Datetime.newInstance(2018, 5, 5),
- Datetime.newInstance(2018, 4, 5),
- Datetime.newInstance(2018, 3, 5),
- Datetime.newInstance(2018, 2, 5),
- Datetime.newInstance(2018, 1, 5),
- Datetime.newInstance(2017, 12, 5),
- Datetime.newInstance(2017, 11, 5)
- };
- for (Integer j = 0; j < testUsers.size(); j++) {
- for (Integer i = 0; i < surveysCount; i++) {
- Integer dateIndex = Math.mod(i, surveyDates.size());
- Integer buIndex = Math.mod(i, businessUnits.size());
- Integer contactChannelIndex = Math.mod(i, contactChannels.size());
- Boolean isDissatisfied = Math.random() <= 0.10;
- Boolean isFCR = Math.random() <= 0.5;
- Boolean isTopTwo = !isDissatisfied;
- Boolean isSolved = Math.random() >= 0.3;
- Integer randInt = (Integer) (Math.random() * 100);
- Integer npsScore = Math.mod(randInt, 10);
- VOC__c newSurvey = new VOC__c(
- Athlete__c = testUsers.get(j),
- Case__c = '5007E000007FTzkQAG',
- Consumer__c = '0017E00000oVWdvQAG',
- Survey_Date__c = surveyDates.get(dateIndex),
- Is_Dissat__c = isDissatisfied,
- Overall_Is_Top_2__c = !isDissatisfied,
- NPS__c = npsScore,
- Is_FCR__c = isFCR,
- Athlete_Is_Top_2__c = isTopTwo,
- Is_Solved__c = isSolved,
- Contact_Channel__c = contactChannels.get(contactChannelIndex),
- BU__c = businessUnits.get(buIndex)
- );
- surveys.add(newSurvey);
- }
- }
- insert surveys;
- Integer usersNo = 3;
- List<User> users = new List<User>();
- Id managerId = UserInfo.getUserId();
- for (Integer i = 0; i < usersNo; i++) {
- User u = new User(
- Username = 'bruce.wayne@gotham.com.nike' + String.valueOf(i),
- FirstName = 'FirstName' + String.valueOf(i),
- LastName = 'LastName' + String.valueOf(i),
- Email = String.valueOf(i) + 'bruce.wayne@gotham.com',
- Alias = 'Batman' + String.valueOf(i),
- CommunityNickname = 'Batman' + String.valueOf(i),
- TimeZoneSidKey = 'America/Los_Angeles',
- LocaleSidKey = 'en_US',
- EmailEncodingKey = 'ISO-8859-1',
- LanguageLocaleKey = 'en_US',
- ManagerId = managerId,
- ProfileId = '00e7E000000IurjQAC'
- );
- users.add(u);
- }
- insert users;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement