-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCreateCase.cls
33 lines (27 loc) · 1.16 KB
/
CreateCase.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//WAP to create 5 Case Records with all the values(Account, Contact, etc) filled in.
public class CreateCase {
public static void getcase(){
Account acc = [select Id, Name from Account where Name Like 'Deepak0'];
Contact con = [select Id, Name from Contact where Name Like '%Deepak0%'];
Product2 pro = [SELECT Id, Name FROM Product2 where Name like '%product0%'];
List<Case> addcase = new List<Case>();
for(integer i=0;i<5;i++)
{
Case objcase = new Case();
objcase.Status = 'New';
objcase.Origin = 'Phone';
objcase.Type = 'Mechanical';
objcase.SuppliedEmail='[email protected]';
objcase.SuppliedName = 'deepak';
objcase.SuppliedPhone = '8126263844';
objcase.Reason = 'BreakDown';
objcase.Subject = 'Subject testing';
objcase.Description = 'Description Testing...';
objcase.AccountId = acc.Id;
objcase.ContactId = con.Id;
objcase.ProductId = pro.Id;
addcase.add(objcase);
}
Insert addcase;
}
}