Skip to main content
On click of command button (from Inline visual force page), I need to open different window for partners or append partners in a URL, when button is clicked from partners community otherwise the regular URL.

 

Command button is like this:

 

<apex:commandButton id="btn" value="Add product" onclick="window.open('/{!IF(boolPartner,$Label.AddOpptyProductPartnerURL,$Label.AddOpptyProductURL)}={!opportunity.name}&retURL=%2Fa0a%2Fo','_blank','height=400,location=no,resizable=yes,to

 

Any idea how we can do this on click..

 

I have tried to write a code on controller but that method was not called:

 

public Controller(ApexPages.StandardController cont) {

 

    String hostVal  = ApexPages.currentPage().getHeaders().get('Host');

 

    String urlVal = Apexpages.currentPage().getUrl();

 

    String URLL = 'https://' + hostVal+ urlVal;

 

    Boolean result=URLL.contains('partners');

 

    system.debug(URLL+'==URLL=='+result);

 

    return result;

 

  }
1 个回答
  1. 2014年7月1日 05:27
    Hi, 

     

    Post this question in developers forum https://developer.salesforce.com ,since this website is concentrated on Configuration part only. 

     

    Here the javascript will execute first, but in most of the cases it doesn't work because before the execution of javascript completes, it is possible to call the controller action. It is better to call oncomplete javascripts instead of onclick.

     

    And try to write these javascript method inside a seperate <script> tag.
0/9000