Newer Version Available

This content describes an older version of this product. View Latest

Try It Out: Give Fields Dynamic Default Values

We can also use custom formulas to give our fields dynamic default values. Some fields like the Travel Required checkbox or the Job Location picklist have default values that apply in every situation. There are other fields with defaults that can't be so easily defined. For example, at Universal Containers, recruiters are expected to fill a position within 90 days of it being opened. We can't choose a single date that will always be 90 days after a position is opened. We can define a custom formula that adds 90 days to the date the position was created. The platform allows us to specify this formula as the Hire By field's default value:

  1. From Setup, enter Objects in the Quick Find box, then select Objects.
  2. Click Position.
  3. In the Custom Fields & Relationships related list, click Edit next to the Hire By field.
  4. Next to the Default Value text box, click Show Formula Editor.

Look familiar? This editor is similar to the one we used to define our Days Open custom formula field.

  1. From the Functions list, double-click TODAY.
  2. Click the Insert Operator button, and choose Add.
  3. Type 90.

Your default value formula is:

  1. Click Save.

It's that easy! Now to wrap up the fields on our Positions tab, let's set the default value of the Open Date field to the day that the record was created. Follow these steps again, but use TODAY() as the Default Value.