Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
9 votes
Accepted

Visualforce: Dynamically ReRender a row within <apex:repeat> by passing $Component through controller

Through attempting this same problem on another project I was able to get a fresh look at the issue. What I learned through countless testing is that rerender attribute can be very tricky. For example:...
Xtremefaith's user avatar
  • 4,560
9 votes
Accepted

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

Wooooow, I finally figured it out. Changing { type: 'comm__namedPage', attributes: { pageName: yourPageName } } to { type: 'comm__namedPage', attributes: { ...
Luke's user avatar
  • 413
7 votes
Accepted

Why does this PageReference take me to the wrong page?

The "apex" resource URL ignores path names, and only uses the last file name on the path. I tested this in my org with: /apex/pages/TestPage And it resolved to: /apex/TestPage I actually didn't ...
sfdcfox's user avatar
  • 494k
7 votes
Accepted

Urban Legend? Must Return PageReference To Rerender

Analysis Conclusion You do not need to return a PageReference for rerender to understand when the action has completed. So if you have a method that will never cause a redirect, you can make it void ...
Adrian Larson's user avatar
  • 150k
6 votes
Accepted

Why does my returned PageReference not work

Your issue is probably down to validation on the page, when validation (required fields or errors) happen they block buttons from firing their actions, for actions where you don't want validation to ...
thegogz's user avatar
  • 368
6 votes
Accepted

Ignore Duplicate Results Alerts for Visualforce Page

You need to use the DmlOptions.DuplicateRuleHeader class. The isAllowSave method is used to determine if a rule allows saving or not (e.g. provide a warning or an error). The following modification ...
sfdcfox's user avatar
  • 494k
5 votes
Accepted

Visualforce Component PageReference Method: Platform Cache PUT() Not Allowed?

As I attempted storing a custom record through another PageReference call within a component I got the following error: System.LimitException: DML currently not allowed While searching for answer I ...
Xtremefaith's user avatar
  • 4,560
5 votes

Bell icon in communities: syntax of the setTargetPageRef string?

I could see it working (outside of Communities, I have not tried that part yet) with the following scenarios: Named Page Type (type = standard__namedPage): quite limited but useful. Item Page Type (...
Jeferson Chaves's user avatar
4 votes

VF controller redirect to another page

You can use cookies Set cookie Cookie elementMsg = new Cookie('msg','true','/apex/pageYouAreGoingToUse',10,false); Add to the current page ApexPages.currentPage().setCookies(new Cookie[]{...
Ruwantha's user avatar
  • 251
4 votes
Accepted

The page you submitted was invalid for your session

The problem is with this line here param.putAll(ApexPages.currentPage().getParameters()); and in particular with the save_new parameter that is being added to the URL causing the error. Similar issue ...
Jenny B's user avatar
  • 10.5k
4 votes
Accepted

Identify the current page name

You can parse the URL to get the name of the current page. String pageName = ApexPages.currentPage().getUrl() .substringAfter('/apex/').substringBefore('?');
Adrian Larson's user avatar
  • 150k
4 votes
Accepted

Pass a parameter without exposing ids

You can do one of two things: Set redirect to false. The URL in the browser should not be updated. Could cause issues depending on the circumstances and the page redirected to must be using the same ...
Eric's user avatar
  • 54.2k
4 votes
Accepted

PageReference redirect

No, you can't redirect from a trigger. You'd have to create a Visualforce page to call the code and then perform your redirect. Also, you should always use StandardController to redirect: return new ...
sfdcfox's user avatar
  • 494k
4 votes
Accepted

How to assert on pagereference where the endpoint of pagereference is predefined

I tend to use .getUrl() and .startsWith() e.g. System.assert(nextPage.getUrl().startsWith(Page.ExpectedPage.getUrl()), nextPage.getUrl()); It's good to use startsWith() in case the controller puts ...
Aidan's user avatar
  • 13.7k
4 votes

How to assert on pagereference where the endpoint of pagereference is predefined

When you compare 2 objects in Salesforce (as far as it is known it is based on Java), it actually compares not objects, but their hashCode results, or what is returned as compareTo method from ...
kurunve's user avatar
  • 4,319
4 votes
Accepted

Why does string.replace fail with char codes?

You should use EncodingUtil class instead of replacing manually. For example: https%3A%2F%2Fdeveloper.salesforce.com%2Fdocs%2Fatlas.en-us.apexcode.meta%2Fapexcode%2Fapex_classes_restful_encodingUtil....
salesforce-sas's user avatar
4 votes
Accepted

LWC URL reading parameters

The State parameter of the URL addressable component using pagereference always needs a namespace. For normal orgs c is the namespace and hence you will need to make sure within the URL parameter you ...
Mohith Shrivastava's user avatar
4 votes
Accepted

What difference does the __c make in currentPageReference in code?

Previously, you could just use keyword, but in order to tighten security, it was changed so that you would need to include the "namespace" as part of the state. For unmanaged code, this is ...
sfdcfox's user avatar
  • 494k
3 votes

Visualforce Page redirect not working from apex actionfunction

try <apex:commandButton value="Create" onclick="createfunction(); return false;" />
Emma's user avatar
  • 31
3 votes

Urban Legend? Must Return PageReference To Rerender

Along with the other answers here, in the VF doc on commandButton, the action= attribute is optional. The same is true for commandLink, actionSupport and actionFunction Hence, the rerendering (i.e. ...
cropredy's user avatar
  • 71.7k
3 votes

Urban Legend? Must Return PageReference To Rerender

Its clear to me that one can rerender what they want whether they return a pagereference or not. I'd cite the many methods used as getters and/or setters that are not pagereferences which can be used ...
crmprogdev's user avatar
3 votes
Accepted

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

Follow the below approach Have single controller class to have logic from both visualforce pages. If Page has standard controller use that class as extension Since controller is same you will not ...
Ashwani's user avatar
  • 22.6k
3 votes

Unable to write Test

The signature of method definition in your test class is wrong. Invalid static void test_redirect() Valid static testMethod void test_redirect() OR as @sfdcfox pointed out. @isTest static void ...
Rohit Mourya's user avatar
  • 3,871
3 votes
Accepted

Visualforce wizard in Community

If set redirect to true, a redirect is performed through a client side redirect. This type of redirect performs an HTTP GET request, and flushes the view state, which uses POST. If set to false, the ...
NITHESH K's user avatar
  • 2,535
3 votes
Accepted

PageReference Parameters Overwritten Even With Different Case?

According to getParameters() documentation, Parameter keys are case-insensitive System.assert( ApexPages.currentPage().getParameters().get('oppid') == ApexPages.currentPage().getParameters()....
Santanu Boral's user avatar
3 votes

Why is the url parameter encoded?

##Background: URLs like "https://salesforce.stackexchange.com" can only contain certain characters. The document that outlines this is RFC3986 From that, the following characters are allowed ...
Derek F's user avatar
  • 62k
3 votes
Accepted

PageReference setRedirect not working!

You're throwing away the return value of redirectByProfile() when you call it in your first snippet. You have to return the PageReference as the result of a Visualforce action method in order for a ...
David Reed's user avatar
  • 93.1k
3 votes
Accepted

Keep focus on desired tab in Salesforce Application

If the new tab which you created is a visual-force tab than add tabStyle attribute in page tag in your MySecondPage page. So the page code would be like : <apex: page tabStyle="TabName__tab"> ...
Pragati Jain's user avatar
  • 1,570
3 votes

How to assert on pagereference where the endpoint of pagereference is predefined

You could use getUrl() method to compare the URLs in an assert: System.assertEquals(p.getUrl(), controller.forwardToCustomAuthPage().getUrl()); Also note that the use ofSeeAllData=true in test class ...
Raul's user avatar
  • 18.8k
3 votes
Accepted

How to test a page with parameters

Well, you don't seem to be instantiating the username and password variables in your controller during the test. So when you call validateCredentials() in your test, the controller doesn't know what ...
Renato Oliveira's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible