+ Start a Discussion
Angel HFAngel HF 

User Custom Fields that are required must have a default value.

Hi,

I am trying to create a Custom field on User object. The custom field should be a Text field as External Id and required, when I am trying to create the field I am getting the below error:

User Custom Fields that are required must have a default value.

Do you now why or possible reasons?
NagendraNagendra (Salesforce Developers) 
Hi Angel,

May I suggest you please double check with the below steps once again which might do the trick.
  • Click on User Menu at the top right of your screen.
  • Click Setup
  • Then on the left side, you will see 'App Setup', click on 'Customize'.
  • Then click 'Users', and finally 'New' button on 'User Custom Fields' section.
This will work for you.

Note: Fields with the following data types can be set as an External ID field
Text, number, e-mail, and auto-number fields.

For more information please check with below link which might help you accelerate further. Please let us know if this helps.

Thanks,
Nagendra
Angel HFAngel HF
Hi,

I have followed same steps. My point is, it seems there is a standard salesforce valdiation that denies to create a custom  text fiel as external id setting as required without default value.

Error: User Custom Fields that are required must have a default value.
 
David HalesDavid Hales
User-added image


Hi Angel,
There is no such validation put by Salesforce. 
As per your requirement i created the field and here is the screenshot for the same. 
Please check and Let me know if it helps.

Incase your issuse is resolved please mark this as a best answer.

Regards 
Kspl 1058
Kloudrac
Angel HFAngel HF
Hi Kloudrac,

Try to make  this field Required as well. Mark the checkbox Required
David HalesDavid Hales
Hi Angel,
Apologies on My part.
Yes, this default functionality of Salesforce.
As you are making this as external Id so you are going to use this field while setting up for some third party tool and as you have made this required in case the user is not filling up with this value at least this default value won't let your functionality to break down.

Regards 
Kspl 1058
Kloudrac
 
Katerina DeHartKaterina DeHart

This is an old post, but I wanted to comment in case others come across it in the future...

If you don't want a default value to populate but you do want the field required, I would suggest a validation rule such as ISBLANK(Custom_field__c) instead of checking the "Required" box. This way, it won't populate a default value, but the user will still be required to input a value in order to save the record. Another option could be to make it required on the page layout, although I would not recommend this if you plan to create and edit records using the API, dataloader, quick actions, etc.

As for the original question - I don't know why Salesforce does this. I can think of many scenarios where you would want a field required but not a default value. A default value could actually be dangerous in some scenarios if the user is supposed to review the field on creation. They may forget to review it and won't be prompted because it will already be pre-populated with a value.

Susanna Sharp 9Susanna Sharp 9
@katerina most excellent info sharing, thank you!
You explain EXACTLY why this is necessary and it works perfectly. In my case I wanted to require users to review the Activity Type field on creation of a new Task. Having a default 'Phone Call' value is useless because if they aren't prompted to review the values and select the most appropriate, most likely will be moving too quickly and just won't do this.

In the spirit of helping others who come along, in my situation, because it is a picklist I could not use ISBLANK. Instead, I used ISPICKVAL(Activity_Type__c, "").