I have a Hierarchical Custom Setting that I need to SOQL use a SOQL query for using the current User's Profile.
Currently I'm using the getInstance() method with the User Profile ID to get the custom setting, then I update a field on it. The problem is that it frequently errors with the Unable_to_lock_row error.
I want to try using a SOQL and the FOR UPDATE to try to prevent this error from happening.
Best Answer
Technically, the custom setting is an object just like other custom objects. So you can do the following SOQL query:
If you're looking for the default setting, replace :profileId with UserInfo.getOrganizationId()