You need to sign in to do that
Don't have an account?

Custom Settings and SF Custom Object fields
Hi,
I'm writing an APEX class that should look for some strings on an xml and populate a SF custom object with its respective fields and values.
The function currently works fine as follows:
public Chat_Details__c UpsertChatDetails ( String sessionId, MAP<String,String> XMLNode){
Chat_Details__c chatInfo = new Chat_Details__c();
pChatInfo.VI_Country__c = getValueFromXML(sessionId , XMLNode , 'geoCountry');
pChatInfo.VI_IP_Address__c = getValueFromXML(sessionId , XMLNode , 'geoIP');
pChatInfo.VI_City__c = getValueFromXML(sessionId , XMLNode , 'geoCity');
pChatInfo.VI_State_Province__c = getValueFromXML(sessionId , XMLNode , 'geoReg');
pChatInfo.VI_ISP__c = getValueFromXML(sessionId , XMLNode , 'geoISP');
return chatinfo;
}
I would like to create the same value assignment by using custom settings in order to give standard users the ability to add new fields to the custom object and be able to look in the XML for the right value.
For this I created a custom settings object called ChatDetailFieldMapping which has two fields (SF API Field Name and XML attribute to be looked for) see attached screenshot.
My question is, how would I go about the same function I created to be able to look into the Custom Setting object and populate the fields based on the custom mapping?
Thanks
Tzuvy
from what I understand, this should work
let me know if this is what you are looking for