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.

Filter by
Sorted by
Tagged with
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 ...
0
votes
0answers
19 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
25 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 ...
3
votes
1answer
837 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 ...
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 ...
1
vote
1answer
28 views

What difference does the __c make in currentPageReference in code?

What is the difference between keyword and c__keyword in the code below? What is happening below? this.searchKeyword = this.currentPageReference.state.keyword ? this.currentPageReference.state.*...
4
votes
3answers
52k views

VF controller redirect to another page

I have a Apex Controller for a VF page. I want to redirect my page to another one, only if I cannot get a specific parameter from the URL. current page: /apex/demo?param=123 -> stay on this page. ...
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 ...
0
votes
0answers
18 views

Can I send complex data when navigating via component.navigate()? [duplicate]

I have an order details lightning component page that makes an api call in the init action call to get all the order details (a giant 2k line json object). Once that page loads, there's an "Item ...
0
votes
1answer
609 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
2answers
27 views

Can we redirect a user into a VF page from an Apex trigger

I have a scenario where a user if he/she uploads a file against a particular record, then the user will be redirected to a VF page after the file upload is successful. I wrote a simple trigger in ...
0
votes
0answers
33 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" &...
7
votes
2answers
585 views

Bell icon in communities: syntax of the setTargetPageRef string?

The Winter '21 CustomNotification Class offers two ways to set the target navigated to when the message displayed under the "bell" icon is clicked: setTargetId(Id targetId) - Sets the ...
1
vote
2answers
290 views

Evaluation of approach to navigate between 3 LWC pages

Looking at building 3 screens and each has navigation between them using next, previous. Finish button to complete. I know that I could use Lighting Flows to navigate but I would not want to use it. I ...
0
votes
2answers
44 views

open new record after finish flow

I created a visualforce page with an embedded flow. But If I click the "NEXT" button it appears the page https://domain.my.salesforce.com/Accountnull, but it should open the new account ...
2
votes
4answers
1k views

How to redirect to standard lead convert page in lightning

Currently, I'm working on lightning migration. So, I'm converting the javascript buttons to related quick actions & quick actions with the vf page respectively. I'm facing issues with the ...
0
votes
0answers
29 views

Test method issue for PageReference method [duplicate]

I am trying to to write a test method for my custom apex controller which contains a constructor and multiple PageReference methods, all returning null. I am trying something like this: @isTest Public ...
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}...
6
votes
0answers
327 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 ...
0
votes
1answer
252 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/...
2
votes
1answer
192 views

LWC URL reading parameters

I am trying to authorize another sandbox/production to create connection. When I first time authorize the connected app, it is returning the Auhorization Code in the URL, however when it gets ...
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 ...
1
vote
4answers
6k views

Redirect after a new record is save from Trigger

I want to redirect the user to a new page after a new record of a custom object CIP System is created from a Trigger. Is this possible? Here is the code I was using: trigger SaveRedirect on ...
0
votes
0answers
83 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'...
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
300 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. ...
0
votes
1answer
405 views

How to get pageReference on target Aura cmp init when being called from a different Aura cmp in a Community?

I've been stuck on this for a solid day now. I have a large package that need to deploy which uses 3 Aura components. They navigate to each other at various times using navigateToComponent. When I ...
0
votes
1answer
32 views

Change ID of record being displayed on record page

When I am displaying a record page (such as https://myorg.lightning.force.com/lightning/r/Lead/00Q3i000004FudyEAC/view), how could my component on that page change the record being displayed? I know I ...
0
votes
1answer
22 views

Redirect issue when input field empty on Visualforce page

I have created an Opportunity Wizard similar to this: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_wizard.htm Just practicing Visualforce pages. I run into an ...
0
votes
2answers
85 views

Why does controller gives: System.NullPointerException: Attempt to de-reference a null object

I have an apexclass with a pagereference for which I am writing a unittest but this returns an NullPointerException on controller.toCareerPageWithFilters(); what am i missing? public class ...
0
votes
1answer
33 views

Unittest eror: System.NullPointerException: Attempt to de-reference a null object

I am writing a unittest for my apex class but get an error System.NullPointerException: Attempt to de-reference a null object on my unittest for variable: testoptions Apex class public class ...
1
vote
1answer
2k views

Navigation and PageReference in Lightning Component - Why is url void?

UPDATE: I just verified it works when I navigate to my Lightning Component as part of a Lightning Page. My company is still in classic, so we're wrapping our components in Visualforce. https://...
1
vote
1answer
25 views

How to show different field value in a vf edit page

Right now I have a vf page that shows like this: <div class="col-md-5"> <input id="contactFirstName" type="text" class="form-control" name="userFirstName" maxlength=40 value="{!contact....
2
votes
1answer
2k views

NavigationMixin.Navigate not navigating to home on community - LWC

I am building a lightning community using LWC, where on successful login trying to navigate to standard home page of the community, but i see no URL redirection is happening.Below is the logic i have ...
1
vote
1answer
210 views

Page Reference issue in Lightning

I have a command link button on Account page (Create Account). As soon as a user clicks on the button, an edit page gets populated to fill the details. Once the details are filled and hit the save ...
4
votes
3answers
4k views

Pagereference not working in Lightning

I have a Detail page button (VF page) and controller for it. I used Pagereferenc method to take user to the record details page: However, it works fine in the Classic, but not in Lightning. ...
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). ...
3
votes
1answer
49 views

salesforce Pre fill value in create page

Is it possible that pre fill value on the create page example: public PageReference Create() { Contact tmp = new Contact (); tmp.Name ='test123'; return new apexPages.StandardController(tmp)....
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 :...
7
votes
2answers
987 views

LWC Navigation (NavigationMixin) Bug. CurrentPageReference Becomes undefined and won't navigate?

I'm running into a bizarre bug that I can't track down. When using NavigationMixin.Navigate it works just fine MOST of the time. But occasionally, it just stops navigating. Digging into it as much ...
9
votes
3answers
6k views

PageReference from embedded Visualforce page becomes inlined

I have a Visualforce page that gets embedded into the opportunity page layout. Part of the embedded page is a command button with an action defined in the controller to redirect the user to another ...
3
votes
0answers
978 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 ...
1
vote
1answer
2k views

PageReference in AuraEnabled class is not working for Lightning Quick Action

I have a Quick Action using Lightning Component on Opportunity. Based on some scenario when a service return Case ID then through Page Reference I would like to return to Case Record Page. Code : ...
0
votes
1answer
66 views

Why does string.replace fail with char codes?

If have a login function that if there is a start URL I want it to go there other wise it should go to the default landing page. When I get the URL it substitutes special characters with char codes ...
1
vote
1answer
35 views

Accounts are not updating when I choose an account type from the dropdown box

I think I need a pageReference for the updateRecordList. Right now it runs but it won't display the accounts with the selected account type. Can anyone explain to me whats wrong? and how pageReference ...
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
1answer
158 views

Test pagereference with selection of multiple Ids

I have a visualforce page where I select multiple ids. Based on my selection I start a flow. I dont know how to simulate the selection in my testclass. Visualforce <apex:page standardController="...
0
votes
2answers
372 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
266 views

Is it possible to use lightning:navigation inside an aura:application?

What I need is a simple link to the org's home page. The documentation doesn't cover the case of aura:application but only cover the case of aura:component. If I copy-paste the example inside an aura:...
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
2 3 4 5 6