You need to sign in to do that
Don't have an account?
amateur1
test case help
i have wriiten a query how i can give this value in test case
ISRList = [SELECT id,name,Date__c,Item__c,Warehouse__c,Qty_Returned__c
FROM Item_Supplier_Return__c WHERE CREATEDDATE=LAST_MONTH];
Hi
Insert the Item_Supplier_Return__c by giving the values for fields which are in query and also for createddate.
u can use.
date currentDate = Date.today();
integer str;
str=currentDate.month();
system.debug('str'+str);
it will returns 6.
if u want previous month means currentDate.month()-1;
Regards,
Rajesh.
i am unable to over write the created date
Hi
Could u post ur class and test class.
Regards,
Rajesh.
You will not be able to test your class if you use the "LAST_MONTH" variable because you cannot write to that field. For data imports, Salesforce support can open up these fields for you, but it's not sustainable for deployments.
What you can do in your class:
if(test.isRunningTest()) {
ISRList = [SELECT id,name,Date__c,Item__c,Warehouse__c,Qty_Returned__c
FROM Item_Supplier_Return__c WHERE CREATEDDATE=TODAY];
} else {
ISRList = [SELECT id,name,Date__c,Item__c,Warehouse__c,Qty_Returned__c
FROM Item_Supplier_Return__c WHERE CREATEDDATE=LAST_MONTH];
}