I'm having problems with my apex code inserting. I don't know whats going on
here is my code:
// object instance with memory allocation.
Work_Order__c wo = new Work_Order__c();
wo.Est_Hours__c = 89;
wo.Instructions__c = 'this is a test';
insert wo;
and I have looked at the system.debug log and this is what I'm getting in the log:
23:54:38.198 (198681448)|USER_DEBUG|[14]|DEBUG|===> insert ===> Work_Order__c:{Instructions__c=this is a test, Est_Hours__c=89, Id=a0j1a000000cbuFAAQ}
but how come its not inserting a new row in the Work_Order__C
object?
Best Answer
As per your discussion with Nick, the view from where you are seeing the records has a filter enabled on it. It may be showing recently opened records
You can see all records by creating a new view ( if not already present ) which will not have any filter and shows all records.
Regarding your question about inserting Picklist values, here is a sample code
Project__c prj = new Project__c();
prj.Project_Name__c='Proj 003';
prj.Project_Status__c = 'Active';
insert prj;
Here Status field is a picklist value. It is ultimately a string field and a string value is saved.
Hope it is clear, you can try and get back in case of any issues.