+ Start a Discussion
Sunita PSunita P 

URLFOR editing Opportunity Contact Role from Visualforce page

Hello Team,

I have created a Visualforce page to display customized Opportunity Contact Role on the Opportunity detail page, the following code is working fine-
<a href="/p/opp/ContactRoleEditUi/e?oppid={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}" target="_top">Edit</a>

I do not want to hardcode the URL, tried using the URLFOR function -- <a href="{!URLFOR($Action.Opportunity.edit, ContactRole.id)}">Edit</a> where ContactRole is the attribute on the apex:pageblocktable -- <apex:pageBlockTable value="{!Opportunity.OpportunityContactRoles}" var="ContactRole">. I'm getting an error 'Content cannot be displayed: Invalid parameter for function URLFOR' and the Visualforce is not being displayed...

Please help..

Thank you.

SandhyaSandhya (Salesforce Developers) 
Hi Sunita,

Please refer below sample code provided in the link by @kanraj which is similar to your requirement.

Hope this helps you!

If this helps you, please mark it as solved.

Thanks and Regards