Questions tagged [pagereference]

A PageReference is a reference to an instantiation of a page. Among other attributes, PageReferences consist of a URL and a set of query parameter names and values.

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
326 views

How to get a PageReference from Site.login(username, password, url) in an Apex Test

When I run this code from within a LWC controller: ApexPages.PageReference pageRef = Site.login(username, password, url); It returns a valid PageReference instance. But when I test the code in a ...
3
votes
0answers
964 views

Get check if a LWC is in a community

I am building a LWC that uses the pageReference that is not available in Communities. Is there a way to check what context you are in from the LWC, whether it's in a community, a record page, or ...
3
votes
1answer
836 views

Redirect visual flow to external URL

Good day Everyone I have created a flow which I embed inside visual force page. After the flow process, I want to redirect the page to external url like 'www.google.com'. The problem is that encounter ...
3
votes
0answers
596 views

Lightning experience embedded page redirect

I've got a VF page embedded into page layout. It redirects user to other VF pages (depending on user action) inside an iframe on page layout. In LE such PageReference redirects sort 'step out' from ...
3
votes
0answers
2k views

Lightning Experience gets 'stripped' when redirecting from Visualforce page

I`m struggling to fix an issue which arise with the new Salesforce Lightning Experience. So, I have a Visualforce page which is assigned to the Edit functionality of Accounts. In Salesforce Classic ...
2
votes
0answers
228 views

Apex help needed for flow finish location

I am trying to set the Finish Location for my flow to either go to the detail page of the Opp created by the flow or reload the flow. My VF page and Apex controller are below. I'm getting an error: ...
2
votes
1answer
1k views

Redirecting from Controller to standard list view page?

I'm using a custom_object and once the user save I want that page to redirect to list view page but what is happening is that right after i click save button i see the white blank screen with the ...
2
votes
2answers
2k views

Redirect to an external site passing variables

I am working on a Visualforce page that will call our internal report server with a few parameters from the page to run a report. However the URL I am calling has a secondary path after the initial ...
2
votes
0answers
450 views

redirect to mobile detail page layout from flow

I am creating a custom object record via a flow. At the end of the flow, the user is redirected to the detail of the record that has just been created in order to add some attachment. Users will use ...
2
votes
0answers
108 views

Email a PDF page to User who clicks

I have a custom button on Custom object Incident. When it is clicked from a particular Incident record a VF page is displayed in PDF format. I need not to show this PDF to the User instead the PDF ...
1
vote
1answer
90 views

Authentication Vulnerability Issue with Page Redirect

We are using a third party company to scan our salesforce code for SOQL Injection and Vulnerability issues with open page redirects. The below code is flagged as a vulnerability. public Pagereference ...
1
vote
0answers
293 views

Upload file to google drive from Lightning component - Page redirect removing URL

I am trying to achieve functionality to upload a file from Salesforce to Google drive. I have done following 1. Google project credentials (Client key , secrete key) 2. Enabled Google drive API 3. ...
1
vote
0answers
45 views

How can I send an email while using PageReference getContent() method?

I am trying to send an email while using PageReference and the getContent() method which is, only ocassionally, throwing an error (seems like every couple of emails regardless of the frequency). ...
1
vote
1answer
44 views

Page Reference not redirecting

I am overriding the case select Record Type page. The page shud redirect to a custom VF page if selected record type is 'Support' else to the standard Case page VF Page : <apex:page ...
1
vote
1answer
118 views

Call Excel VF Page from a static method in controller

I have a MS Excel VF Page that perfectly downloads data. Now in main VF Page I am having a remote action static method called using vf remoting from button on main page. From that method I need to ...
1
vote
0answers
274 views

Logout from all tabs when from one tab a user logged out

I have a requirement like ,i have opened 2 3 tabs.And lets say i logged out from 1st tab.Then without refreshing my other tabs how will the user be redirected on to the login page. On tab 2nd there is ...
1
vote
0answers
525 views

PageReference for quote/quoteTemplateDataViewer as PDF is blank

I'm having trouble getting a PDF when using a PageReference to the quoteTemplateDataViewer. This class is creating a QuoteDocument on the Quote record, but the contents of the document are blank. ...
1
vote
2answers
320 views

unable to instantiate flow in controller

I'm trying to set the finish location of a flow to the record created in that flow. I've tried setting up the controller a million different ways, but I keep getting an invalid page redirection error ...
1
vote
0answers
289 views

Get PageReference returned by callback of continuation, and navigate to it

I've spent many hours scouring the net and trying different coding options to get a very simple function accomplished, with no luck.  There are no examples anywhere that I can find, and SF's ...
1
vote
0answers
1k views

Why does setRedirect(false) on a public page(Site) is not working?

public EventsController(){ eventId = ApexPages.currentPage().getParameters().get('id'); } I got this first vf page button: <apex:commandButton action="{!BookerInformation}" value="...
0
votes
0answers
10 views

How do I make my visualforce page rerender?

I'm using visualforce & apex classes to build a page where i'm outputting records from custom object. On the visualforce page I have a date field that on submission, will update the outputted ...
0
votes
0answers
16 views

PageReference.state.inContextOfRef is returning undefined

I am on a record page and have an overridden 'New' standard action for a related list (child object). I am trying to get the record Id from the current page as the parent Id when I click 'New' from ...
0
votes
0answers
46 views

How to avoid hardcoding the URL in Apex class

I wrote this code looking at references and documentation. However, I want to prevent hardcoding of the URl . Also, the email that I receive goes to my company's junk mail box. What best practice can ...
0
votes
0answers
32 views

Redirecting to a url from a visualforce page

I am transformin a javascript logic in vf page into a apex controller. Here is the code: <apex:page standardController="Medical_Event_vod__c" extensions="SendinviteController" &...
0
votes
1answer
243 views

To Pass attributes used in Lightning component via e.force:navigateToURL

Am calling Target component (lightning page) from a source component var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "url": "/lightning/n/...
0
votes
0answers
20 views

How to pass field value from one page to other in Salesforce Site

I created Force.com Site in salesforce, it has 2 pages. First page is used to save the contact record and second page will be used to upload any documents to newly created contact. Here problem is I ...
0
votes
0answers
82 views

Getting the URL parameter into Lightning component that implements flexipage

I have a component that is in a Lightning Page, I need to read parameters from the URL and handle their onchange. I found out that I can't use pageReference (always null) due to my component flexipage'...
0
votes
0answers
42 views

How to set subtab label of a component opened from another component using only PageReference and not workspace API

When i open a subtab from my main component, the label is loading... I only need to use pageReference type and as per the requirement, i cannot use worksapce API. Need help. My code: ViewCallHistory :...
0
votes
0answers
163 views

Return Null loses Parameters in Visualforce Page

I have a Savepoint set in apex controller. Inside the try block, I am having Pagereference set to redirect to newly created record id page. On Catch block, I simply want to put return null so that ...
0
votes
2answers
366 views

How to get recordId for pageReference with Lightning

I am trying to navigate to an object's record page once it is created after a button click but the recordId is currently showing as undefined when I print it to the console. Any idea how to retrieve ...
0
votes
1answer
606 views

How to close window automatically once the excel file got downloaded?

I have command button while clicking the button it will redirect to VF page where it will renderas data as excel also it will open a site.Once the excel download is completed,the window needs to be ...
0
votes
1answer
299 views

Page reference url is appending base url as well and not opening the page

so I have a page reference implemented in my apex page PageReference mypage=new PageReference('http://10:7:8...') which should ideally be opening in a new tab hitting the url mentioned on the click ...
0
votes
1answer
282 views

Apex message present the message in new blank page

I have custom button which send email, I would like notify the user regarding if the action fail/success - but the message always present in new blank page. I wish the message to be presented in the ...
0
votes
0answers
266 views

Display in existing window with sidebar with PageReference puts page within page

I have a pretty simple Apex Controller + Action which I lifted from Salesforce Sidekick that takes a Flow, skins it up in Lightning Experience, and redirects to the newly created record. The issue I ...
0
votes
1answer
153 views

Apex:ActionRegion blocking Controller function Action

I'm trying to call a simple function in my Apex Controller and want to use an actionRegion to stop most sections of the page re-rendering. I note though when I add the actionRegion the controller ...
0
votes
0answers
399 views

Return to same page after pagereference

I am having a VF page that generates content as excel, which I am calling from another page as a commandLink. The problem I am facing is when I click the commandLink, the current page becomes blank. ...
0
votes
1answer
21 views

Am I allowed to have a variable url in a PageReference redirect in a managed package released on the App Exchange?

I've created a managed package and I'd like to release on the Salesforce App Exchange. But if failed the security review. Salesforce gave these reasons: -CRUD/FLS Enforcement -CSRF -Insecure ...
0
votes
0answers
408 views

How to use page reference and rendered simultaneously?

Hello, everyone! I am developing a website on Salesforce. And I have some pages redirections along with usage of rendered. In particular, I have a home page where products divided by categories are ...
0
votes
0answers
2k views

How to implement shopping cart in visualforce?

I am developing a website in Salesforce, which is going to be an online-shop. I have pages of products divided by categories. Product object is custom, it has fields Name, Price__c, Quantity__c, ...
0
votes
3answers
164 views

call pageReference method in test class (there is only class no any vfpage)

call pageReference method in test class (there is only class no any vfpage) public Pagereference pgredir(){ String RT = ApexPages.CurrentPage().getParameters().Get('RecordType'); String url = '/'...
0
votes
1answer
93 views

cover pagereference method in test class and there is no pagename mention only /+lead.id mention

this is class code public pagereference AcceptLeadFromDetail(){ AcceptLeadButtonSupport((new list<Id>{objLead.Id})); if(bShowAcceptMessage) return null; ...
0
votes
0answers
26 views

cover pageReference method in test class

this is class code public pagereference RedirectToPrePopulatedLeadPage() { PageReference editList = new PageReference(LABEL.SFA_NEW_LEAD_RET_URL); editList.getParameters().put(LABEL....
0
votes
0answers
871 views

Cyclical server-side forwards detected:

I'm trying to override my custom_object__c page layout to the custom Visualforce page. Go to Buttons, Links, and Actions of my custom object Edit: Select my visualforce page New: Select my ...
0
votes
0answers
60 views

PageReference Keep Page Original Text Case (Upper and Lower)

This may be been asked before (I couldn't locate it), but given the below example. I need to create a url for a custom field, but the case changes. Is there a simple way around this to keep the ...
0
votes
1answer
145 views

How to stop downloading of CSV After calling controller class method

I am creating a CSV. but on click its simultaneously downloading for current user and also adding in Notes & attachment. But I don't want it to download for user. It should jut add to Notes & ...
0
votes
0answers
475 views

Email send with PDF Attachment

I have a VF page with below custom controller. I am not getting the exact point why the email is not getting generated. Can someone please help? Apex Controller public with sharing class ...
0
votes
2answers
108 views

How to pass the value of a command link to different pages and perform action based on it?

I have a scenario where I wound choose a command link value based on the chosen value an action will be performed for "next" button in the third page which is a common page for both the command link ...
0
votes
1answer
110 views

Null Pointer exception to add blob to list of blob

I have below piece of code where I am getting a Null pointer exception adding blob to a list of blobs. Can someone let me know my mistake please? Apex code counter=1; form = integer.valueof(...
0
votes
1answer
217 views

PageReference | Page - How to set pageReference in unit-test for extendedClass

I have a VFP called myUIPage that has some input fields, some of which are bound to the Opportunity object ("standardController='Opportunity'"). There is also some functionality for this page that ...
0
votes
3answers
433 views

VF page with Edit / Del in page layout not working correctly

I have added an vf page in layout which contains Edit/Delete links. <apex:column HeaderValue="Action"> <apex:commandLink value="Edit" action="{!editAccountContactRole}...