Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
This doesn't work. Any ideas?
COb__c c = [select Parent__r.Name fro Cobj__c limit 1];
String parentName = c.get('Parent__r.Name');
COb__c c = [select Parent__r.Name fro Cobj__c limit 1]; String parentName = c.get('Parent__r.Name');String parentName = c.Parent__r.Name; //TRY This?
Your object names don't match. In the future if you post the error it is very helpful in troubleshooting your problems.
This works.
Sobject p = c.getSObject('Parent__r');
p.get('Name');
Thanks. The object names was a typo. Even with that typo fixed, it doesn't work. You have to do what I just posted.
In my case, I do have to use .get, since I don't know the name of the field ahead of time.
Your object names don't match. In the future if you post the error it is very helpful in troubleshooting your problems.
This works.
Sobject p = c.getSObject('Parent__r');
p.get('Name');
Thanks. The object names was a typo. Even with that typo fixed, it doesn't work. You have to do what I just posted.
In my case, I do have to use .get, since I don't know the name of the field ahead of time.