You need to sign in to do that
Don't have an account?
lovetolearn
Need help with Apex class
Hi,
I am trying to write a Apex class to find all the SDO days associated with a user based on the user input on the VF page. I didn't get any errors from my code, but not sure why it is not working. Here is my code:
public with sharing class exDeleteSDO { public exDeleteSDO(ApexPages.StandardController controller) { } public String sdoType{get; set;} public Date sdoFrom {get; set;} public Date sdoTo {get; set;} public string empName{get; set;} List<Schedule_Days_Off__c> sdolist; public void setempName (String empName){ this.empName = empName; System.debug('This is the name' + empName); } public void setsdoType (String sdoType){ this.sdoType = sdoType; System.debug('This is the type' + sdoType); } public void setsdoFrom (Date sdoFrom){ this.sdoFrom = sdoFrom; System.debug('This is the date' + sdoFrom); } public void setsdoTo (Date sdoTo){ this.sdoTo = sdoTo; System.debug('This is the date' + sdoFrom); } public PageReference deleteSDO(){ sdolist = [SELECT ID FROM Schedule_Days_Off__c WHERE Employee_Name__c =: empName]; try{ delete sdolist; } catch(DmlException e){ } return null; } }
Please help. Thank you.
could you remove the try/catch and post if gives an error, or paste the debug log here
Try adding one line and see the result in Debug log :
Check the log and let us know if you see any record in there ...
Hi,
The debug log return no records. I am not sure why though. I am sure that there are records.
Please let me know where I made a mistake.