I’m trying to set a default value on a reference field on page load in Salesforce. I’ve tried using the Default Items option under Override using both a fixed ID value and an ID from another model. Neither way populates the lookup with a value. Is there some other trick to set a default on a reference field?
lisaa - the “metadata override” method requires you to set up more of the plumbing about reference fields than I think you want to.
The easiest way to set a default value on a new record is to use model conditions. Though you usually think of these as impacting what data is queried, they also can be used to set default values on new record creation. Using the “Field from another model” condition type is a great way to do this. Just make sure the model that is Source for this data is above the Target model - so that the data is available to be passed as default on page load.
Here is an example configuration:
Here I’m passing the Id value from the Account model into the “Account ID” field on a new opportunity. Make sure you have the Id and the Name field retrieved in the Account model.
Let me know if you have further questions.