public with sharing class LeaveRequestSampleData {
public static void createData(){
Id currentUserId=UserInfo.getUserId();
List<LeaveRequest__c> leaves=new List<LeaveRequest__c>();
leaves.Add(new LeaveRequest__c(User__c=currentUserId,From_Date__c=Date.newInstance(2023, 03, 10),To_Date__c=Date.newInstance(2023, 03, 11),Reason__c='For personal reason',Status__c='Approved'));
leaves.Add(new LeaveRequest__c(User__c=currentUserId,From_Date__c=Date.newInstance(2023, 03, 15),To_Date__c=Date.newInstance(2023, 03, 15),Reason__c='Test',Status__c='Pending'));
leaves.Add(new LeaveRequest__c(User__c=currentUserId,From_Date__c=Date.newInstance(2023, 03, 19),To_Date__c=Date.newInstance(2023, 03, 19),Reason__c='For personal reason',Status__c='Rejected'));
insert leaves;
}
}
LeaveRequestSampleData.createData();
After executing the above instance I was getting an error "Missing <EOF> at LeaveRequestSampleData.createData();" Help me out in this!
Hello @Rohit Arora, have you other code in the same class / file ?
Then, please try to cut the code, and paste the code again (value paste, not normal paste) to avoid any weird character in the class.
Eric