+ Start a Discussion

custom setting linked to a object

can i have custom setting linked/related to a custom created object .


Abhinav GuptaAbhinav Gupta

Custom setting itself is a Custom Object internally, you can do almost everything you can do with Custom Objects on Custom Settings.


i have a code which i feel is trying to store the RecordTypeId into a custom setting field and then use it while inserting a


I am not able to figure out how to get  the RecordTypeId for a new record before carrying out an insert quert for new record.

Abhinav GuptaAbhinav Gupta

Sorry Sangeeta, 


I think its still not clear to me. But I can assist you with a couple of points.



  • Query RecordType table and see if you can get the required ids.
  • If you want to fetch RecordTypeId from an Sobject, its just a regular field available. Make sure you include that in projection for the SOQL i.e. Select ID, RecordTypeId from Sobject where... 
  • If your CustomSetting's name is MyCustSetting, then you can easily do MyCustSetting.getInstance().FieldName__c = 'RecordTypeId', still it depends on type of custom setting you are using, so consult Apex language reference for more details.
Let me know if you need more info.