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
0
votes
0answers
44 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
26 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
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
2answers
26 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
31 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
2answers
36 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 ...
7
votes
2answers
556 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
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
1answer
237 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
81 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
89 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
0answers
317 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
0answers
290 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
393 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 ...
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
2answers
82 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
2answers
280 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
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 ...
2
votes
1answer
186 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 ...
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....
1
vote
1answer
208 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 ...
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
48 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 :...
6
votes
2answers
962 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 ...
3
votes
0answers
951 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 ...
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
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
162 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
152 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
360 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
262 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 ...
0
votes
1answer
57 views

Soql on Account returns empty Id

I have a controller where I get a token from a visualforce page with account as a standard controller and controller extension. In my unittest I insert the variables but the accid throws an exception ...
0
votes
1answer
32 views

How to test a page with parameters

I am writing a unittest for a pagereference where I add some variables I currently get only 47% coverage. How do I pass the variables correctly. I currently get the error: System.NullPointerException:...
4
votes
3answers
302 views

How to assert on pagereference where the endpoint of pagereference is predefined [duplicate]

I have a pagereference for which I want to write a test class but get the error Expected: System.PageReference[/CustomLoginPage], Actual: System.PageReference[/CustomLoginPage]. What am I doing wrong:...
1
vote
1answer
222 views

Passing parameter in URL in Lightning component and community pages

will it work in community pages, if yes then how, can you brief me? this is url and i am passing parameter in it as key= sunil https://deb1-coro.cs17.force.com/v2/s/invdetail?key=sunil var ...
0
votes
1answer
994 views

How to redirect to external url from apex from callout response

I have a class from which I do a callout in apex. After the response of the callout I want to redirect the user to an external url how can I achieve this?. I have only been able to redirect ...
0
votes
2answers
413 views

How to Redirect to /secur/logout.jsp from @Invocable method

I have a requirement where I want to logout of salesforce when certain statement inside an @invocable method is executed. For this purpose, I am trying to use PageReference to redirect to "/secur/...
3
votes
1answer
2k views

Does <lightning:navigation> support targeting Visualforce pages with URL parameters?

I'm working on a Lightning component that includes a button, whose purpose is to load a Visualforce page rendering a PDF cover sheet. I'd like to use the most current supported functionality, so I'm ...
0
votes
1answer
276 views

call apex method from Form element

Is there a way to call Apex method to save the values in a form element? For example : <form id="scan-form" action="https://www.huika.com/payment/index.php/starting" method="post" ...
0
votes
0answers
27 views

Test class for pagereference in a method [duplicate]

I am unable to get code coverage for my pagreference, my code is code: public class selectedcase { public list<recordtype> record {get; set;} public id ids; public selectedcase(){ ...
0
votes
1answer
323 views

PageReference with Spinner

I have two-page references, on the first page I am performing a DML operation which takes time around 1,2 seconds, and then it goes to the next page. What I want is a loading symbol for those 2 ...
0
votes
3answers
391 views

Load a visualforce page in apex controller

Is there a way to load a visual force page in apex controller without viewing the page. The scenario is this I have a visualforcepage with apex:chart embedded. This page will save the chart as an ...

1
2 3 4 5 6