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.
292
questions
0
votes
1
answer
36
views
CurrentPageReference State is always coming as null
I am trying to fetch the parameter from url in lwc. LWC is embedded in community page.
Here is the code:
import { LightningElement, track, wire, api } from 'lwc';
import { CurrentPageReference, ...
0
votes
0
answers
44
views
PageReference to redirect after logout in Aura components?
I've been reading this documentation on aura components: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_navigation_page_definitions.htm but my method is not ...
1
vote
0
answers
119
views
LWC lightning__UrlAddressable Subtab State Error
I have created a subtab component which has a lightning__UrlAddressable target. And I am calling it from another component whose code is given below. The issue which I am getting is that it works fine ...
1
vote
1
answer
54
views
How to wait for a VisualForce script to execute when calling it from an Apex method via PageReference?
I have an Apex controller MyController which calls a VisualForce page via PageReference.
Here is my controller:
public with sharing class MyController {
@AuraEnabled
public String param1 { get;...
1
vote
1
answer
163
views
VF page reference getContent() call returns HTML not PDF blob
I'm having an interesting problem trying to send an email to a Contact with a PDF attachment. I've got a VF page that renders as a PDF, and an page controller apex class that creates the email and ...
2
votes
0
answers
74
views
PageReference PDF preview does not display data
I'm trying to create a visualforce popup that displays a preview of a generated PDF (also using visualforce) with tables showing custom object data. The preview window displays the PDF with all the ...
0
votes
1
answer
569
views
How to identify which region the LWC component is locating in App Page or Record Page?
I have an lwc component that is enable in App Page and Record Page. Whenever using this component, I want this component can identify which page is using it and which region on that page is it being ...
0
votes
1
answer
411
views
Get PageReference from Page.variable
I am trying to dynamically set a PageReference based on a variable.
String pageId = '0664A000000AAaA';
String pageName = [SELECT Name FROM ApexPage WHERE Id =: pageId ].Name;
PageReference pdf = Page....
0
votes
1
answer
595
views
not able to fetch recordId from currentpagereference
I'm trying to get recordId from currentPageReference, I tried to get this from
also like this -
this.pageRef = this.currentPageReference();
this.recordId = this.pageRef.state.c__id;
but it's ...
0
votes
1
answer
247
views
onPageReference doesn't work
I have a custom lwc that navigates to an aura and it's working fine but whenever I change the url parameters the onPageReference method from the aura is not working.
This is my lwc code:
this[...
-1
votes
1
answer
390
views
Get the page from where the button is clicked
The New standard button in the Salesforce is overriden by the Lightning component (Aura).
Now this New button is being used in the multiple places:
While creating a contact record from the list view ...
0
votes
1
answer
929
views
How to get the api name of the quick action which invoked the flow?
I am using a generic flow which can be invoked from multiple objects. In Flow, I have embedded the LWC Component, by using the Currentpagereference I am able to get the quick action name of the only ...
2
votes
0
answers
307
views
CurrentPageReference in Debug Flow context
It seems that a Wire call to CurrentPageReference does not work when the LWC is embedded in a Flow Screen when run in the context of Flow Debug mode. This works when the LWC is embedded in a page, and ...
0
votes
0
answers
81
views
Error on previously visited page
im having this kind of error. I want my page to redirect to the last valid page it goes to instead of Account-Show. For example, when I click on a product and I decide to Log-in, after successfully ...
1
vote
1
answer
148
views
ApexPages.currentPage().getContent() returns different value when called from actionFunction than from commandButton
I have a visualforce page with the code below. I am calling a apex method on page load that gets the pages content to send in an email. The getContent function returns junk information if called ...
0
votes
0
answers
340
views
URL on List button not accessible through LWC
I need to override the 'New' button for a custom object on related list present on Opportunity.
I'm navigating to a custom app page in which I have my LWC component. I need to pass the Opportunity ...
1
vote
0
answers
243
views
Apex - PageReference - Report URL
When our org was in classic, we had the below code which used to save a report as an Attachment. This has worked for the past 7 years...
PageReference reportLink = new PageReference('/'+reportId+'?...
0
votes
1
answer
302
views
How to disable command button before the action?
Please help! I need that the button "Save" to be inactive before the user changes the Status in position. I tried to do this with disabled="{! If (Status==null, true, false)}". ...
0
votes
1
answer
5k
views
Download a VF page as pdf with a button
I want to have a button that dowload a pdf page as a file related to the record from where I pressed the button. My page is working well, but I had to add a controller so clicking on the button ...
1
vote
1
answer
410
views
trying to create a form in Visualforce page through custom controller, preview showing blank
while seeing preview its showing blank on salesforce classic
also, custom controller class showing not found.
<apex:page standardController="Timepagenew" >
<apex:form>
...
0
votes
1
answer
2k
views
LWC initializing Modal/popup when Record Page loads
I created a LWC Modal/Popup component, a simple modal window to display some text. This modal window has OK and Close buttons.
To test this modal/popoup I added a button to call it in the Record Page ...
0
votes
1
answer
505
views
LWC - registerTestWireAdapter for lightning/navigation with imperative call from wired fails
Let's say we have
@wire (CurrentPageReference)
getStateParameters(pageRef) {
if (pageRef) {
/// some statements here
this.setSomeData();
}
}
setSomeData() {
getCardData({
...
0
votes
1
answer
831
views
page reference is not navigating to edit page in lightning
I'm working on a lightning component under quick action. I'm trying to navigate the user to the edit page but it's navigating to the standard view page.
var navService = component.find("...
1
vote
1
answer
758
views
Static resource get files from zip
I want to give files from zip in static resource. How can i do it? It gives me 404 on getContent() anyway: with file ending(png,txt, etc) and without.
PageReference pageRef = PageReference....
0
votes
1
answer
196
views
How to create a PageReference (url) to approval history?
I have a visualforce button that submits an approval request. I would like the method to return a PageReference that brings the user to the full Approval History related list. I can't seem to figure ...
0
votes
0
answers
36
views
Construct Page Reference for a Survey Response Page
I am attempting to use a custom notification to send a survey reminder to a Salesforce user. I cannot figure out how to designate the page reference argument to the flow action that generates the ...
0
votes
0
answers
104
views
Page Reference and If Statement
I am looking to add another if/or statement that will also look for if the phone number is Anonymous to be redirected to the contact page. Here is what I have. It is working but I need to add ...
0
votes
1
answer
458
views
Resetting page while displaying success message
I am trying to reset/refresh my page on my form. I want to refresh the page and then successfully display the success message however, it is only refreshing the page. The success message fails to load....
1
vote
1
answer
361
views
NavigationMixin Page Reference throwing error
I've been at this for a few hours. I'm using JS directly from official Lightning documentation. I've added my custom LWC to Lightning Builder, and I'm getting the following error.
In the JS below, I'...
2
votes
0
answers
503
views
pageReference.state.c__fieldValue is getting as undefined
In my Aura component, I am trying to access this URL value using below implementation:
var pageReference = component.get("v.pageReference");
component.set('v.fieldObj',decodeURIComponent(...
4
votes
0
answers
1k
views
Return Record Id of newly created Record After Using NavigationMixIn.Navigate
I have created a button in a custom LWC that when clicked, the below js runs.
This opens the standard salesforce new record create modal and the user can then enter information to create a new record.
...
0
votes
1
answer
185
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 ...
2
votes
0
answers
1k
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
0
answers
756
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
1
answer
45
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.*...
0
votes
0
answers
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
2
answers
932
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
2
answers
471
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 ...
9
votes
2
answers
3k
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 ...
0
votes
0
answers
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 ...
1
vote
1
answer
325
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 ...
6
votes
0
answers
2k
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 ...
1
vote
0
answers
935
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
1
answer
4k
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
1
answer
69
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
1
answer
287
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 ...
2
votes
4
answers
4k
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
2
answers
389
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 ...
1
vote
2
answers
1k
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
1
answer
63
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 ...