New Record (Default) Values
When creating new records, setting user reference fields or date time fields to current values are very common. The opened by and opened at fields are great examples of this.
But what if you want to add this same logic to new fields you have, either on a form or a catalog item?
The answer is simple: using a Dynamic Reference Qualifier. Let’s take this example of a Date Time Field and a User Reference Field.
To begin, right click the field of interest, and select the configure dictionary option. From the opened dictionary entry, select the Default Value to ‘Use dynamic default’.
For a date time field select Now (Date and Time), for a user reference select Me. Both these different dictionary options are shown below.
Now, any time you create a new record, the unsubmitted form will have the default values set with the specified dynamic options.
Existing Record Values
But what if instead of setting a value when a record was being created, you want to set a value on a specific update?
For example adding a ‘last commented’ field that sets the current user when additional comments changes? Or setting a work start time to the current time the moment state changes to work in progress?
Both these cases can be handled by using business rule actions. For the user, you simply need to use the ‘To (dynamic)’ ‘Me’ option. For the date time however, you need to enter the following text into the value field: javascript:gs.nowDateTime();
Just like that, you are now successfully setting the value of user reference and date time fields to dynamic options!