function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ed055Ed055 

access parent field in the custom link button

I have a custom object called "Request" and that has lookup relationship with contact. Contact has a field called "topParent"  which has lookup relationship to an ACCOUNT . I have a custom field in account called CHANNEL .

I want to use a custom button when user clicks "New"  in the "Request" related list on contact page .  I have created a custom button called "New Request" on "Request" object. I'm trying to access CHANNEL(which is at account level) field in this custom button by doing {Contact.topParent __r.Channel__c} .. but it throws "field does not exist error" when I try to save.   Not sure if I'm missing something. 

Thanks.
William TranWilliam Tran
Request lookup relationship to contact is called "Contact"? 

Check the name, at minimum, try Contact__r.topParent __r.Channel__c

Also, as a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 

Thanks
 
Ed055Ed055
William - thanks for your suggestion . Yes, the API name of the lookup field on "Request" object is Contact__c   . 
I tried you suggestion Contact__r.topParent __r.Channel__c    but that did not work. 

 
Ed055Ed055
In simple terms ..
Contact has a lookup field called topParent to account
I have a related list on contact  called "REQUEST" . I have to overirde the new button in this related list.
When I create custom new button for this related list how will I access the "channel"  on account object  through topParent lookup field relationship .

I did sosql query   select  Contact.topParent __r.channel__c from contact where id='003E000000XWVGZ'  and I can get channel field data.   I'm not sure why I cannot get the channel  in the custom button  by doing {!Contact.topParent __r.channel__c }