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
1
vote
0answers
22 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
36 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
27 views

@wire(CurrentPageReference) pageRef is not working in Salesforce mobile app

I am using @wire(CurrentPageReference) to get data passed from previous page. Here is my code: In first page navigating to second page like this: this[NavigationMixin.Navigate]({ type: "...
0
votes
0answers
26 views

Test Class for Page Reference Method Help [duplicate]

I'm not sure where to get started with writing this test class. I'm a junior developer and when trying to test createCourse PageReference method I get either an insert or assert fails, or I get an ...
0
votes
0answers
14 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 :...
5
votes
2answers
157 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 ...
2
votes
0answers
65 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
527 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 ...
0
votes
1answer
142 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
23 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
32 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
15 views

Inserting the values for selected field of the required object

I just want to insert the value for the selected field name of the selected object. I wrote the code but i am still little bit confused to write the code regarding the insert operation. please help me ...
0
votes
0answers
58 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
41 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
92 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
48 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:...
0
votes
0answers
84 views

PageReference redirect shows old data on refresh

I have a custom detail button on Contact that launches a VF page with an Apex class that updates data on the Contact record. At the end of the Apex class, I have a PageReference redirect, but when the ...
1
vote
1answer
38 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
46 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
28 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
201 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:...
0
votes
1answer
84 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
223 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
0answers
21 views

Need help writing a test class for this Apex class [duplicate]

I am very new to Apex and was able to write this class to clone a record. However, when I tried to deploy it to Production I only had 70% code coverage. I think my next step is to write a test class ...
0
votes
2answers
204 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/...
0
votes
0answers
173 views

Dynamic redirection to Kanban listview

I'm trying to add on Account page layout, a quick action that will redirect to the Kanban listview showing related Opporutnities records to this Account only. Right now I'm trying to achieve this by ...
2
votes
1answer
579 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
111 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
162 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
100 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 ...
5
votes
1answer
652 views

Spring19 release:Uncaught (in promise) TypeError

keep getting the following js error in my lightning component after the Salesforce Spring19 release: Can any one help please contextService.js:2 Uncaught (in promise) TypeError: Cannot read property '...
0
votes
1answer
300 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
111 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 ...
1
vote
2answers
331 views

Redirect back to the VF page

In Classic: There is a New button on the VF page. On click of this button default new record create a page of the custom object gets open. On saving of the record, the page gets redirected to the VF ...
0
votes
1answer
191 views

How to redirect to another page in controller

I have developed one visualforce page and controller for account object and checking account.type is empty or not. If account.type is empty then page should be redirect to other page, this should be ...
0
votes
2answers
342 views

How to Redirect same page After clicking save button?

I have created visual force page for updating records from the page. . in my code Owner__c is Parent, Vehicle__c is Child. once i enter value owner object discount__c field , i need to update same ...
0
votes
1answer
21 views

Site.com visualforce page refresh

I want to refresh a site.com visualforce page on submission of a form, adding an additional query string parameter, but when I try and get the current page url it returns the /apex/controllerName ...
2
votes
1answer
240 views

Save PDF Visualforce as attachment - mergefields not showing

I really need your help because I'm completely stuck. I want to render a PDF from a Contract in Salesforce, and save it as a record's attachment. I followed several tutorials and I created a PDF ...
1
vote
1answer
997 views

PageReference.getURL() returning URL:[delegate:{MY RELATIVE URL}]

Im am trying to get the URL of one of my PageReferences whenever i call its method to return it to me i get this result URL:[delegate:{MY RELATIVE URL}]. Anyone know if why it's returning this, Please ...
1
vote
1answer
95 views

Keep focus on desired tab in Salesforce Application

I am having an application in which I have added one Tab in it also it has a default Home Tab. Now I need to open up another visualforce page on a button click. I have used PageReference here : ...
1
vote
1answer
288 views

PageReference setRedirect not working!

We are using lightning experience - servivce console. I am using following code to redirect the page flow to an error page for certain profiles. I can see in the debug logs that the PageReference is ...
1
vote
1answer
50 views

Apex Inputtext not getting assigned to variable in apex controller

I have below pageblocksectionitem in VF Page. <apex:pageBlockSection showHeader="false" columns="2" id="blockseciframe" > <apex:pageBlockSectionItem > <apex:...
0
votes
1answer
254 views

Static method cannot be referenced from a non static context (PageReference)

What is wrong here? Candidate__c cand = new Candidate__c(); insert cand; PageReference pageRef = Page.UploadCandidatePhotoVF; Test.startTest(); Test.setCurrentPage(pageRef); ...
1
vote
1answer
668 views

Why is the url parameter encoded?

Let's say I have a map object which will be converted into URL parameter. Map<String, Object> params = new Map<String, Object>{'accountId' => '0x10'} https://test.com/...
1
vote
1answer
64 views

Populating multiselect picklist from page reference

I'm sending some parameters to custom controller of my object, which should be populated on multiselect picklist. In controller I'm creating a new Page Reference, where I put all parameters by using ...
4
votes
2answers
3k views

lightning:isUrlAddressable pageReference returns null

I'm trying to use the new lightning:isUrlAddressable interface to pass a few variables into a lightning component that is inside a lightning tab. In the init function I try to get the pageRefernce ...
1
vote
1answer
67 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 ...
0
votes
1answer
171 views

how to cover pageRef.getParameters().put('id', MR.Id);

I know that so many questions like that. but no one answer is correct for me. How to cover below lines? (image below) Test public class TERF_Controller_CreateNew_TEST { static testMethod void ...
0
votes
2answers
225 views

PageReference .getParameters Method - Javascript Equivalent

Is there a javascript equivalent to the .getParameters method of the PageReference Class? Elaboration of what I'm trying to do: I am have a VFP search page and a CTI adapter. The CTI adpater pops ...