Use Case I have a custom address field on a custom object and I want it to be prefilled with the Shipping of an Account that is a Lookup on the custom object. State and Country/Territory Picklists is configured to allow the state Niederlande and a few other states.
My Approach In a record triggered flow (before create) I assign the values from Shipping Address of the Account to the custom address field on the custom object:
My Problem When debugging, everything works fine. But when running in system with the flow activated I receive the following error message:
Pickup Address (Country/Territory): bad value for restricted picklist field: Niederlande
Trying with Apex I tried to set the value using Apex and retrieved the same error. Even the following lines failed:
List<PicklistEntry> picklistEntries = Agreement__c.Pickup_Address__CountryCode__s.getDescribe().getPicklistValues();
agreement.Pickup_Address__CountryCode__s = picklistEntries.get(0).getLabel();
insert agreement;
How can I assign the Shipping Address of the Account to the custom Address field on the Custom Object?