Skip to main content
Daniel Brenner (Abastible) ha fatto una domanda in #Apex
Hi, 

I have a button in a visualforce page, inside the stadard Account layout, that calls a JS function with a link:

loadLink('/apex/GestionarPoliza?accId={!Account.Id}&callType=OUT');

In the function I open a tab using this:

function loadLink (link) {

if (link != null && link != '' && !link.includes(null)) {

sforce.console.openPrimaryTab(null, link, true);

}

}

The problem is that in the controller of the opened tab, sometimes when I do this:

public String accId = Apexpages.currentPage().getParameters().get('accId');

accId is null. 

I am testing this opening one account in Salesforce console, then clicking the button in the VF page to open the tab. With the same account I press the button, wait for the tab to open, close the tab and repeat. Sometimes it works great, sometimes the accId (as well as all other parametrs and even the getUrl() ) are null, it's completly random. I don't know what else to try.

Any help would be appreciated!!!

Thanks!!!

 
1 risposta
  1. 17 dic 2016, 05:06
    Hi,

    Why you are writing java script buto you can user apex method .

    Use pagereference methode .

    Regards ,

    Harish.R.
0/9000