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
SidzSidz 

How to override the functionality of a button on a related list in a page layout using vf page

hi, i am trying to override the functionality of a button on a related list in salesforce standard page. i have added a visualforce page to that layout and am trying to change the properties of the parent page(the vf page is kept in a iframe) it throws me an error that cross domain scripting is not allowed. i am able to achieve the same using scontrols but salesforce is planning to withdraw support for them or it is not in best practice to use them. what is the alternative ? Thanks in advance, Sidz
bob_buzzardbob_buzzard

So if I understand correctly, you have an embedded VF page inside a standard view page and from that you are attempting to alter the target of a button?

 

The browser won't let you do that, as you've seen its a classic case of cross site scripting.  Does the button have to be dynamically rewritten, or do you always want it to do the same thing?  If the latter you could create a custom list button. 

SidzSidz

hi bob_buzzard,

the button has to be dynamically rewritten and the only way i can see that is by using s-control which is not suggested as a best practice.

 

is there any solution for cross scripting issue for vf pages ?

 

bob_buzzardbob_buzzard

Its the browser that is protecting you from XSS rather than SalesForce. 

 

Could you remove the button from the list and have it as part of your VisualForce page?  If not, I'd stick with the S-Control.  Although VF is supposed to be a complete replacement, it isn't as powerful with regard to this sort of behaviour.