How can we give a link to a VF page so that it loads in same window? The usage required is to share the VF page URL in a salesforce record.

For Ex, there is a link to a VF page in Task Record. We are dynamically setting this URL in task record. Now, the old URL is opening in a new window.

I understand that we need to change the generated VF page URL but how should it look like so that it can open in the same window from a text area?

Thanks in Advance! Peace!

  • are you generating link with a href tag? – tugce Oct 27 '16 at 13:25
  • Right now, yes! – Vignesh Damodharan Oct 27 '16 at 14:33

To open a link in same window you can use target attribute of a tag in html.

Account a = [SELECT Id, URL_area__c FROM Account WHERE Name = 'Company ABC'];
a.URL_area__c = '<a href="/apex/YourVFPageName" target="_self">Your link description</a>';
update a;

You will see link opening on same window

| improve this answer | |

I know this is a bummer.

Having an URL field and populating the whole URL did the trick. I was expecting the URL to be populated in a text area initially, but then we are now ok with moving on to a additional custom field in the package.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.