Skip to main content
12 votes

How to catch internal Salesforce error in APEX?

Internal Server Errors are just that; errors that occur in the runtime environment that are not accounted for. For example, the runtime knows how to express a NullPointerException, but it doesn't know ...
sfdcfox's user avatar
  • 497k
6 votes
Accepted

Search functionality in Visualforce Page

In theory, yes, but realistically, no. The Visualforce reRender engine causes input elements to lose focus, repeated calls in a short period can cause the view state to become disorganized, ...
sfdcfox's user avatar
  • 497k
6 votes
Accepted

Javascript to calculate total at row and column level

The DOM Id values in Visualforce tables include a row number (the :0: in your JavaScript) so your logic needs to incorporate that. The approach that I think works best is to use a CSS class (that has ...
Keith C's user avatar
  • 136k
6 votes
Accepted

Visualforce URLFOR parameter binding

If you look at Valid Values for the $Action Global Variable, NewCase is not listed. The correct action is New. Take a look at the Visualforce Developer Guide - Functions. The syntax is {!URLFOR(...
Adrian Larson's user avatar
  • 151k
5 votes
Accepted

How to show Columns of Visualforce Page Based on Custom Settings Fields?

Use a Field Set instead. It was designed with this scenario in mind. Working with Field Sets You can use dynamic bindings to display field sets on your Visualforce pages. A field set is a grouping of ...
Adrian Larson's user avatar
  • 151k
5 votes
Accepted

Is it possible to get the label or describe from an SObjectTypeToken?

Controller: public class Test{ public Schema.SObjectType myProperty { get; private set; } public Test(){ myProperty = Schema.getGlobalDescribe().get( 'Account' ); } } <...
Ronnie's user avatar
  • 2,116
4 votes

Visualforce dynamic rendering based on Object Type

The "easiest" way would be to go down the dark, dark road of Dynamic Apex, because Visualforce has a problem binding to non-SObject types dynamically. The only other alternative I can immediately ...
sfdcfox's user avatar
  • 497k
4 votes
Accepted

Dynamic Describe Result

Referring to blog http://blog.jeffdouglas.com/2011/10/20/getting-salesforce-field-metadata-the-easy-way/ you can get field information using a Describe call. public static Map<String, Schema....
Devendra's user avatar
  • 5,075
4 votes

Assign Ids dynamically to Apex:inputField

You can't dynamically assign the Visualforce id attribute. You can, however, assign data- attributes or pass through html- attributes. See, for example, Setting Custom HTML Attributes on Visualforce ...
Adrian Larson's user avatar
  • 151k
4 votes
Accepted

How can I dynamically add input fields in visual force on a button click?

This is a very common requirement. First add a Add row button with ypur table <apex:commandButton value="Add More" action="{!addNewRow}" rerender="frm" Status="status" immediate="true" /> and ...
Tushar Sharma's user avatar
3 votes

Set Visualforce Picklist value from custom controller

You have a string variable PeriodCode and a method getPeriodCode of return type List<SelectOption>. This is confusing and not a good practice. I just changed the String variable name and it ...
abdn's user avatar
  • 525
3 votes

How to refresh the parent page after a Save action in a Visualforce page embedded in a page layout?

@Rao's answer works for me in Classic as of Winter '17 release. But if you have a form the user is submitting and you get back errors you may not want the page to have opened in the parent frame, ...
Doug Ayers's user avatar
  • 4,196
3 votes
Accepted

Dynamic Select Option in Remote Objects Visualforce. This page is not record-specific

You can use remoting for this purpose. Here's a generic page that loads the record types for Account (replace with your desired object): <apex:page > <apex:remoteObjects jsNamespace="...
sfdcfox's user avatar
  • 497k
3 votes
Accepted

Visualforce Email Templates Dynamic Subject Child Object

You can't access the child that way, unfortunately. If the credit review is more of a 1:1 relationship, I'd recommend that you create a lookup field on the opportunity and populate it with the child ...
sfdcfox's user avatar
  • 497k
3 votes
Accepted

SLDS in Visual Force - How to render a conditional div?

Use apex:outputText: <apex:outputText rendered="{!someCondition}"> <div class="slds-grid slds-wrap slds-gutters"> ... </div> </apex:outputText> Or, you can add in ...
sfdcfox's user avatar
  • 497k
3 votes

Hard coded images - How to convert

You can set the url dynamically by using the getSalesforceBaseUrl() method in the URL class. This will always get the current instance for the org so you don't have to manually update it each time. ...
Brian Simpson's user avatar
3 votes
Accepted

How to keep components out of the Visualforce view state when they are not needed?

I've gone with generating the components in Apex and hooking them into the page via an apex:dynamicComponent. This solves my view state problem: each unused extension point now consumes 30 bytes (an ...
Keith C's user avatar
  • 136k
3 votes

List view button without standard controller

No. The best you can do is move the core markup you want to not duplicate into a Visualforce Component instead. You need one top level Visualforce Page for each object you wish to support, end of ...
Adrian Larson's user avatar
  • 151k
3 votes
Accepted

Open model/dialog/VF Page/LWC Component from Salesforce trigger

No, you can't do this. Triggers are backend functionality only and may execute in contexts that have no associated user interface session You must implement this type of functionality on the front end ...
David Reed's user avatar
  • 93.2k
2 votes
Accepted

Saved Records in Read Only Mode on Refresh in VIsualforce

I faced a similar issue that you have faced. I used OutputField and inputfield both in order to make it available for readonly as well as edit mode. <apex:inputField value="{!account.type}" ...
Pranay Jaiswal's user avatar
2 votes
Accepted

Unable to set focus on <apex:inputText> inside an ouput panel of visualforce page

apex:actionFunction has an attribute called focus which is meant to specify the ID of the component that is in focus after the AJAX request completes, so you could probably use that with the $...
RenegadeCoder's user avatar
2 votes

How do I send translated emails based on the language on the user record?

First, you'll need a template for each language that your org allows your users to use. Next, you'll need to use Global variables like $User to determine both their LocaleSidKey (controls how numbers, ...
crmprogdev's user avatar
2 votes
Accepted

Red, Amber, Green (RAG Status) text color dependent on field number value in visualforce

Just use: {!IF(cObject__c.FieldName__c < 50, 'red', IF(cObject__c.FieldName__c < 75, 'goldenrod', 'green'))}
Adrian Larson's user avatar
  • 151k
2 votes

How to assign default value for dynamic pick list in visualforce page

Just do: public String selected { get { return (selected == null) ? 'Contact' : selected; } set; }
Adrian Larson's user avatar
  • 151k
2 votes

Select multipicklist record from custom VF lookup page

You need to handle the saving of the selected values in the popup controller (in the done() method). In order to do this, you need the Id of the Event that you started from. In order to pass that to ...
Guy Clairbois's user avatar
2 votes

How can I get picklist values using Dynamic Visualforce Bindings?

As Greg Grinburg says, it is impossible to achieve the result you want through dynamic VisualForce bindings alone. However, it may be worth noting that your workaround can have an equivalent degree ...
quietopus's user avatar
2 votes
Accepted

No Data showing in my data table. SLDS Visualforce

You are just preparing the table but not have appended the table in JavaScript, here is a working example: <apex:page standardController="Account" showHeader="false" standardStylesheets="false" ...
Raul's user avatar
  • 18.8k
2 votes

Dynamic inputfield in visualforce

You can achieve that with <apex:inputField>, pass the FieldName dynamically in the value attribute of <apex:inputField> and it will render your required field on VF. for example <...
user2809299's user avatar
2 votes

Page Layout for Accounts via Script

You can include Page Layouts in the managed package, and then they will be deployed alongside the rest of your work as normal during install. It is generally not advised to include overriding page ...
Simon Lawrence's user avatar
2 votes

Pass javascript variable to apex variable , error : cannot set value of null

Directly addressing the problem in the page as posted, the $Component documentation rather vaguely says: If your component is nested, you might need to use a more complete component path ...
Keith C's user avatar
  • 136k

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