I have a managed field from a package. The requirement is such that I can not add this field to page layout. But when I create or clone a record some managed code throws the error that the particular field is required. Since it is not included in page layout, users can not set any value.

Is there any way I can set a default value for this field?

Thanks in advance.


The authors of the managed packaged must be validating the field in a trigger -- which sounds like a good idea, until you run into a customer who doesn't have a use for the field, or for some reason, can populate the field in the same way every time.

If the managed package is a required component, I don't know of any solution for this problem, unless the author of the managed package publishes an update that lets you indicate a default as a custom setting (or something).

Or, removes the validation altogether. If it's a situation where it would might be reasonable for someone to use a default, then it's questionable as to whether the field really needs to be required (or whether the package author needs to check for null or empty fields).


| improve this answer | |

You could try using a Before Insert Apex Trigger to set the value for you?

trigger CaseBefore on Case (before insert) {
        if(Trigger.new != null){
            for(Case cs : Trigger.new){

                if(cs.YourField__c == null){
                    cs.YourField__c = 'Your Value';
| improve this answer | |
  • I tried this solution already. But I think since managed package is throwing the error trigger is not even fired. – Anutosh Datta Sep 14 '12 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.