+ Start a Discussion

How to convert String field name to field token

HI All,


I have stored contact field API name in other object as text.Now i am retriving that field name and need to convert as field token.


For eg:

list<CampSetup__c> allCampmember= [select id,ContactDate_ApiName__c,Name from CampSetup__c];
                 map<String,String> mapallcamp = new map<String,String>();

//map defines campaign name as key and contact date field Api name as value        

                  for(CampSetup__c cc :allCampmember)


now i have all the field name values in my map

Campaign  camp = [select id,name from CampaignMember where id ='abdcksf'];

CampaignMember con = [select id,name,Contact.abcd__c from CampaignMember where id ='abdcksf'];

when i try try to access

Date dd =con.Contact.(mapallcamp.get(camp.name)) //which gives an error as the map value is a string not field token


Please let me konw how to get the fieldtoken.







I am also stucked in here...any luck?