Using a CommandButton/CommandLink to Open a New Tab/Window

Community Driven Extensions Project
Post Reply
Taylor36
Posts: 1
Joined: 25 Feb 2021, 12:21

25 Feb 2021, 12:24

I'm looking to use either a CommandButton or a CommandLink to open a new tab or window. This is largely a problem because the URL is somewhat dynamic.

Effectively I have a list with checkboxes, the user will select some records which they need which should open up another tab containing the URL and Ids selected. It looks a bit like this:

String redirect = URL.getSalesforceBaseUrl().toExternalForm() + '/apex/AnotherApplication?firstcontact=' + firstContact + '&queue=' + queue;

PageReference pageRef = new PageReference(redirect);

return pageRef;
This produces a URL like below depending on what's been WalgreensListens Surveyselected:

www.salesforce.com/apex/AnotherApplicat ... ,003GHI789

I'm fairly sure I can't use CommandButtons to do this, and when I use a CommandLink, using the parameter...

target="_blank"
... Is ignored.

Is there any way around this or am I SOOL?

Thanks!
Last edited by Taylor36 on 26 Feb 2021, 13:19, edited 1 time in total.

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

25 Feb 2021, 15:28

Why not use a link or linkbutton like this...

Code: Select all

<p:linkButton  id="lnlSalesForce" value="Bookmark" href="#{myView.buildSalesForceUrl}" target="_blank" />
Then in your CheckBox selector just have AJAX update that button eveyr time a checkbox is selected

Code: Select all

<p:ajax process="@this" update="lnkSalesForce" />
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests