REQUIRED_FIELD_MISSING, Required fields are missing: [LastName, Company]
Closed this issue · 3 comments
westhechiang commented
Hey there,
I heard about this tool on the Code Coverage podcast and wanted to give it a try. When I used it to create a Lead, I got an error message about missing LastName and Company. I thought Test Factory was supposed to fill those fields in for you?
Much appreciated,
Wes
dhoechst commented
Hi Wes,
This code is meant as a starting point for you to build on. For each object you need test data for, you should make sure that there is a defaults class specifying the values to go in that object. If you add something like this to the code, I think you'll get it to work.
public class LeadDefaults implements FieldDefaults {
public Map<String, Object> getFieldDefaults() {
return new Map<String, Object> {
'LastName' => 'Last',
'Account'=>'Company'
};
}
}
dhoechst commented
An alternative is to use https://github.com/mbotos/SmartFactory-for-Force.com. It puts data in all fields.
westhechiang commented
Ah I see. Thank you! That makes much more sense.