Not sure if this is possible, but I'd like to be able to prepopulate the value in a lookup field when creating a new record.
Specifically:
I have a lookup field to a custom Office object on my Opportunity object. On my User object, I have a picklist that correspond to the names of each record of the Office object. When I create a new Opportunity, I would like for the Office field on my new Opp to be prepopulated with the Office that is named on the running user's record.
E.g. User record has office picklist of "New York", Branch record with name "New York" exists in system. User creates a new opp and the "New York" field is already populated in the Branch lookup field.
I tried using "Lightning URL hacking" with a custom URL button using something like:
/lightning/o/Opportunity/new?defaultFieldValues=Office__c=New York
, but naturally passing a string here doesn't work and causes the field to not appear in the new record UI and causes an error upon saving.
Any help or confirmation that this is even possible is appreciated. Note: I want this to exist as a button on the Opportunity list view.