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 ...
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(...
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 ...
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, ...
5
votes
How to create nth level tree hierarchy structure in salesforce?
Without resorting to client-side rendering, you can do it like this.
First, create a Node class to store nodes and their children.
public class Node {
public String title { get; set; }
...
5
votes
How to extract a number from a string
I prefer using regular expressions. You can replace all non number characters with empty character, and you will have only numbers left.
This regex says: any character a-z or A-Z or dash
String ...
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 ...
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' );
}
}
<...
4
votes
I have api objectfield name, how can I get the label?
another simple way to display field label from apex, is like this (if the object and field is not to be dynamic) :
Schema.SObjectType.Contact.fields.Student__c.getLabel()
If it is to be displayed ...
4
votes
Get Map values inside vf Component and in apex:repeat
Looking at the provided Component and Controller markup, I believe you are getting the error because you trying to iterate over a string value.
Looking at this
< apex:repeat value="{!mapkv[key]}"...
4
votes
Accepted
Visualforce | Multi Conditional Block Rendering
Once you are in a Visualforce {! } expression fields are referenced without a further ! (and a ! prefix becomes shorthand for a NOT function). Also the result of the AND function is already a boolean ...
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....
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 ...
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 ...
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 ...
3
votes
Accepted
Getting a VF component dynamically by name in Apex
After exhaustively searching around this topic I finally found what appears to be the answer:
Loading a custom component into a Visualforce page dynamically
Dynamic components on a Visualforce page
...
3
votes
Accepted
URLFOR/Component.Apex.OutputText in Unit Test causing Internal Server Error?
The problem is that unit testing does not currently invoke an entire Visualforce context. I have received a story number (with safe harbor attached) that this will be considered for a future version. ...
3
votes
Accepted
" Error occurred while loading a Visualforce page " in Portal Site,
@SFDC_Igle you can try one thing. In standard exception Page you will find one line as shown below
<apex:param value="{!error.messages}" />
which you should change to
<apex:param value="{!...
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, ...
3
votes
Accepted
Disable selectList after selection is made
You can try one thing. Check if recordType not null then then hide this field
<apex:outputText value="{!recordType}" rendered="{!recordType != null || recordType != ''}"/ >
<apex:...
3
votes
Accepted
How to hide or show (<DIV>) items dynamically in a VF Component?
You need to split your Previous/Next navigation into uniquely addressable elements rather than grouping them together, and, ideally, use an <apex:outputPanel> or <apex:pageBlock> or even &...
3
votes
Creating VF page by using Salesforce Tooling API . JSON_PARSER_ERROR
You don't need to escape the double quotes because Apex uses a single quote as a string delimiter.
The best way to create JSON is not by concatenating the string yourself but letting JSON.serialize ...
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 ...
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="...
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 ...
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 ...
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.
...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
dynamic-visualforce × 434visualforce × 346
apex × 200
visualforce-component × 86
javascript × 34
dynamic-vf-component × 30
community × 20
controller × 12
dynamic-soql × 11
soql × 9
dynamic-binding × 9
email-template × 8
picklist × 8
pageblocktable × 8
dynamic-apex × 8
trigger × 6
css × 6
jquery × 6
custom-controller × 6
unit-test × 5
custom-object × 5
pdf × 5
dynamic × 5
lightning-aura-components × 4
reporting × 4