Retrieving Values from Custom Settings

I have created a Custom Settings ‘Tal_Source_Map__c‘ which has 4 fields.

  • SF_Source_Type__c
  • SF_Source_Sub_Type__c
  • Tal_Source_Type__c
  • Tal_Source_Type__c

Combination of SF_Source_Type__c and SF_Source_Sub_Type__c will have a unique set of Tal_Source_Type__c and Tal_Source_Type__c.

How can I get Tal_Source_Type__c and Tal_Source_Type__c values using SF_Source_Type__c and SF_Source_Sub_Type__c?

Is it possible to use getInstance()?


You can use SOQL to query Custom Settings just like an object. Use a SQOL query to find the right value:

select Tal_Source_Type__c, Tal_Source_Type__c from Tal_Sourc_Map__c 
where SF_Source_Type__c = :someval and SF_Source_Sub_Type__c = :otherval

Source : Link , Question Author : Yash Mehta , Answer Author : Daniel Hoechst

Leave a Comment