function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jordan WightJordan Wight 

Why is the default picklist value not working?

I have a custom field on a custom object with a default picklist value. When I create a record via the UI, the default value is respected. But when apex creates the record, the default value is not respected, and the field remains blank. I am not using record types. It is not a controlling or dependent picklist. 
Jordan WightJordan Wight
It's actually in a managed package so I can't tell. I have tested this in another org and it's working. So there must be some difference besides the code.
Mahesh DMahesh D
Hi Jordan,

Is there any other trigger which is emptying the value.

Regards,
Mahesh
Jordan WightJordan Wight
I found out it is working in the sandbox because someone created a workflow to set it. But the workflow shouldn't be necessary if there is a default value. I don't know if there is a trigger which could empty the value, if there is no other ideas then I would have to pay a developer to check on this, and it might be easier just to use the workflow to set it.