Tag Archives: Force.com

Displaying Help Text in Visualforce Page

<apex:page standardController="Campaign" showHeader="true">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection title="Information">
                <apex:pageBlockSectionItem HelpText="{!$ObjectType.Campaign.fields.Category__c.inlineHelpText}">
                    <apex:inputField value="{!Campaign.Category__c}" label="{!$ObjectType.Campaign.fields.Category__c.label}" />
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Tab Title shown as External Page in Console

<apex:includeScript value="/support/console/20.0/integration.js"/>
<script type="text/javascript">
	function testSetTabTitle() {
		//Set the current tab's title
		sforce.console.setTabTitle('Account: {!Account.Name}');
	}
	var pageLoad = window.onload;
	window.onload = function() {
		testSetTabTitle();
	}
</script>

Disable filed in Visualforce page based on picklist values

Here in below example, I’ve a requirement on selection of “Category” picklist value “Product”, “Detail” inputfield will enable with required mark else will disable.

<apex:page standardController="Campaign" showHeader="true">    
    <apex:form >
        <apex:pageBlock>
            <apex:pageBlockSection title="Information" id="pb1">
                
                <apex:pageBlockSectionItem>
                    <apex:actionRegion>  
                        <apex:inputField label="{!$ObjectType.Campaign.fields.Category__c.Label}" value="{!Campaign.Category__c}">
                                <apex:actionSupport event="onchange" rerender="pb1" />
						</apex:inputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
                
                <apex:pageBlockSectionItem>
                    <apex:outputLabel value="{!$ObjectType.Campaign.fields.Detail__c.label}" for="wurl" rendered="{!Campaign.Category__c=='Product'}"/> 
                    <apex:inputField id="wurl" value="{!Campaign.Detail__c}"  rendered="{!Campaign.Category__c=='Product'}"   required="{!Campaign.Category__c=='Product'}" />
                </apex:pageBlockSectionItem>
				
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Label does not get displayed when inputField is in an actionRegion

Action Region will wrap only the input Field and not the complete pageBlockSectionItem. Place pageBlockSectionItem tags inside a pageBlockSection, which in turn should be in a pageBlock. This will provide the correct formatting.

<apex:page standardController="Campaign" showHeader="true" >
	<apex:form>
		<apex:outputPanel id="op1">
			<apex:pageBlock>
				<apex:pageBlockSection columns="2" title="Information">
					<apex:pageBlockSectionItem>
						<apex:actionRegion>
							<apex:inputField label="{!$ObjectType.Campaign.fields.Category__c.Label}" value="{!Campaign.Category__c}"> 
								<apex:actionSupport event="onchange" rerender="op1" />
							</apex:inputField>
						</apex:actionRegion>
					</apex:pageBlockSectionItem>
				</apex:pageBlockSection>
			</apex:pageBlock> 
		</apex:outputPanel>
	</apex:form>
</apex:page>

Salesforce System Fields

The following fields are Salesforce system fields found on most objects. These fields are read-only and automatically updated during API operations.

Field Field Type Description
Id ID Globally unique string that identifies a record. Because this field exists in every object, it is not listed in the field table for each object. Id fields have Defaulted on create and Filter access.
IsDeleted boolean Indicates whether the record has been moved to the Recycle Bin (true) or not (false). Because this field does not appear in all objects, it is listed in the field table for each object.
Audit Fields
CreatedById reference ID of the User who created this record. CreatedById fields have Defaulted on create and Filter access.
CreatedDate dateTime Date and time when this record was created. CreatedDate fields have Defaulted on create and Filter access.
LastModifiedById reference ID of the User who last updated this record. LastModifiedById fields have Defaulted on create and Filter access.
LastModifiedDate dateTime Date and time when a user last modified this record. LastModifiedDate fields have Defaulted on create and Filter access.
SystemModstamp dateTime Date and time when a user or automated process (such as a trigger) last modified this record. SystemModstamp fields have Defaulted on create and Filter access.