I created a Custom Setting to store an Id so I do not have to hard-code it. The custom setting API name is SQUAD_GLOBAL_VALUE_SET_ID__c
and is of type 'Hierarchy'. It has 1 field called Squad Picklist ID
(api name Squad_Picklist_ID__c
) and is of type text(50). I have set the default value of that field to the Id.
When I use:
SQUAD_GLOBAL_VALUE_SET_ID__c SQUAD_GLOBAL_VALUE_SET_ID = SQUAD_GLOBAL_VALUE_SET_ID__c.getInstance('Squad Picklist ID');
I get the error System.InvalidParameterValueException: Invalid SetupOwner for Custom Settings: Squad Picklist ID
When I use: SQUAD_GLOBAL_VALUE_SET_ID__c SQUAD_GLOBAL_VALUE_SET_ID = SQUAD_GLOBAL_VALUE_SET_ID__c.getOrgDefaults();
I do not get any errors, but the value returned is { }
.
When I use:
SQUAD_GLOBAL_VALUE_SET_ID__c SQUAD_GLOBAL_VALUE_SET_ID = SQUAD_GLOBAL_VALUE_SET_ID__c.getValues('Squad Picklist ID');
I get the error Invalid SetupOwner for Custom Settings: Squad Picklist ID
Finally, when I run the SOQL Query select Id from SQUAD_GLOBAL_VALUE_SET_ID__c
I do not get an error, but it says 'No rows returned' which is strange. I have Googled and tried lots of solutions but nothing works. I think I may have set up the custom setting incorrectly.