I am trying to get field value from a dynamic SOQL result. Here i have a object where end user need to enter the field name which he need. I am SOQL it like this:
UserprofileSOQL = 'SELECT Contact.'+homepgProfile[0].UserProfile_Field__c+',
Contact.Account.'+homepgProfile[0].AccountProfile_Field__c+'
FROM User WHERE id = \''+ userID +'\'';
where homepgProfile[0].AccountProfile_Field__c
and homepgProfile[0].UserProfile_Field__c
from an object where the end user enter the filed name.
Now i am trying to get the field value from the query result. I try to get the field value
as userProfile = userLst[0].Contact.homepgProfile[0].UserProfile_Field__c
but i am getting the following error:
Save error: Invalid field homepgProfile for SObject Contact. MY CODE userProfile = userLst[0].Contact.homepgProfile[0].AccountProfile_Field__c;
Please guide me the proper way to get the solution.