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
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
1answer
2k views

PageReference add Page.PageName

Here is the problem. I have one controller for both pages and I need to have that controller because of view state. I am passing values from home to about us page. I am getting two different behaviors ...
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="...
1
vote
1answer
1k views

Void Method inside of Pagereference method does not fire

I have two different code samples. I am calling the PageReference method as an action on a CommandButton. Code Sample 1: public without sharing class MyClass{ public MyClass{ } public ...
0
votes
2answers
6k views

Id Value is not valid for standard controller

I am getting the error mentioned in subject with below code when execution runs through Else condition without DML statement. I am not getting how to change Pagereference? Apex Code AllocQ= ...
0
votes
2answers
733 views

Create a record in Edit mode

I am trying to open a record in Edit mode when a record type is selected. I am using the following code Im doing some mistake but dont know what. PageReference('/e?retURL='+Apexpages.currentPage()....
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 ...
0
votes
1answer
310 views

PageReference redirect

I'm trying to get a page to redirect to a custom object that is being created in the below class but it's not doing it at the moment. Can I call this class from a trigger and get the page to ...
0
votes
1answer
103 views

Pass a parameter without exposing ids

Is that possible to pass an parameter without exposing in the URL? public PageReference goToNextPage() { PageReference pageRef = Page.MyNextPage; pageRef.getParameters().put('AccId', ...
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
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:...
0
votes
2answers
4k views

How to test class called through a button with Visualforce

I Have this apex class which is called trough a button calling a visualforce page. How do I test my Pagereference in my testclass? I do not have coverage from // Code we will invoke on page load. ...
0
votes
3answers
36 views

Unable to write Test

I am trying to write a simple test class for redirection. I want to pass redirect url through vf page . ApexPages.CurrentPage().getParameters() I want to use this and redirect. I wrote a small ...
0
votes
1answer
1k views

Get multiselect field values (selected) values from one vf page to another

The case is next. On Custom vf page with a standard controller user might to select Users, He hit the Add users button and opens the second vf page (custom controller) with multiselect field. After ...
0
votes
2answers
742 views

Test Method for Custom Controller which returns PageReference

I'm trying to define a test method to call a class constructor but somehow it doesn't work ///I create the test data, set Page Parameters etc Test.setCurrentPageReference(new PageReference('...
0
votes
1answer
686 views

setting value in action method

Action method is called but Username is null in visualforce VisualForce page: <apex:page controller="exampleCon"> <apex:form > <apex:actionFunction name="sayHello" action="{!...
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
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 ...
0
votes
1answer
156 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
1answer
1k 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
1answer
476 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); ...
0
votes
1answer
282 views

Visualforce Page Redirect Weird Same-Origin

I have a pretty simple save action in my controller that redirects to record from pageReference but its returning an error Refused to display 'https://cs72.salesforce.com/0015D000009wrmEQAQ' in a ...
0
votes
1answer
2k views

How to write test class on Blob method

I have a PageReference method as given below I am trying to write a test class for this it shows error. Error Message: System.NullPointerException: Argument cannot be null. Stack Trace: ...
0
votes
2answers
102 views

Same Id for all the records using apex:commandLink

I could not find the solution where I can assignTo value to a getter/setter in the controller When hover over the commandLink I see the same Id for all the 30 records so the Id value i'm getting from ...
0
votes
1answer
306 views

PageReference not redirecting to the desired page

I have a commandLink in a table that calls a method in the apex controller when clicked. I want it to open the page that has been assigned in the pageReference but instead its loading the same page ...
0
votes
1answer
44 views

getting error in covering pagereference method of controller

getting error- System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name] error in pagereference method ...
0
votes
2answers
563 views

How to navigate from a VF page to some other SF page without nested header and sidebar?

I have a Visualforce page with its own controller. One of the buttons on the page must go to a standard Opportunity page. I thought I would use this: return new PageReference('/' + oppId).setRedirect(...
0
votes
2answers
4k views

How to solve this error “Return type of an Apex action method must be a PageReference. Found: visualforce.el.VisualforceArrayList ”?

Basically I have custom button in datail page .When i click this button,I have four picklist and checkbox in VF.I have to click atleast one picklist one checkbox .After clicking save button some ...
0
votes
1answer
1k views

Test pagereference redirection to detail page

I am writing a test for a method in CreateNewCase class. This method in CreateNewCase class creates a new case and redirects the page to the new case's detail page.: public PageReference createCase()...
0
votes
1answer
2k views

getting Unexpected token error for test class

Hi I am trying to pass this id through page reference to my controller for the test coerage. but this line below gives me an error saying unexpected token: '.' Test Class @IsTest public class ...
0
votes
1answer
108 views

Multiple blob creation for creating multiple PDFs

I have below piece of code to generate a PDF file. I have a requirement to create multiple blobs for multiple PDFs. I am trying to do so but not working as expected. Apex code PageReference pageRef =...
0
votes
2answers
683 views

PageReference redirecting to wrong url

I have a force.com site with custom url for my web2lead just say www.company.com/step1. i want redirect it to www.company.com/step2 after button clicked but it redirecting to www.company.com/step1/...
0
votes
1answer
44 views

How do I brng value from one Visual Force Page to another ?

I Want to bring value of Picklist from one visual force page to another? In I have got one Visual force page called edit. And another visual force page called Lookup. On the Edit page I have a ...
0
votes
3answers
4k views

open pdf in new tab

I have a generate pdf button which open the pdf and simultaneously store the same pdf as an attachment in Case object. But now i want is,pdf should open in new tab leave generate pdf button pafe as it ...
0
votes
2answers
352 views

No error..But failed to redirect to case page

I have written two method cancel and save.Both methods are redirecting me to case page. Only difference is my save method save the object first and den the redirect happens. When i clicking the save ...
0
votes
1answer
813 views

Page.pagename OOPS Concept

We use Page.pagename to get the Page Reference of a Visual Force Page. I am unable to get the OOPS concept related to Page.pagename Here Page is a class? pagename is a static variable? What is this?...
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
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
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:...
0
votes
2answers
420 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
1answer
278 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
3answers
398 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 ...
0
votes
1answer
428 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
1answer
23 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 ...
0
votes
1answer
347 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
462 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 ...
0
votes
1answer
268 views

How Does the Results of Page Reference GetContent Works?

I found this code somewhere else as I was trying to retrieve the API Usage from the System Overview. I'd like to grab some other details inside this page and I want to know the explanation behind this ...
0
votes
1answer
961 views

Save button in visualforce page not working

This is my visualforce page which displays the selected contacts from the previous page and a list of contacts in a picklist. <apex:form> <apex:pageBlock title="Selected contacts" > &...
0
votes
2answers
461 views

How to redirect to record detail page on selecting pick list value

Controller public class picklistController14July { public string selectedItem{get;set;} public list<selectOption> getAccountRecs(){ list<selectOption> aList = new list<...