How to limit number of records to be processed per transaction in Batch Apex?
The Database.executeBatch method takes an optional parameter scope. This parameter specifies the number of records that should be passed into the execute method.
Syntax:
Database.executeBatch(instance of batch class,scope);
Sample:
AccountUpdate au = new AccountUpdate();
Database.executeBatch(au,1500);
The limit for scope parameter is 2000.
The default value is 200.
If the scope value is greater than 2000, it will consider as 2000 and then process.
Syntax:
Database.executeBatch(instance of batch class,scope);
Sample:
AccountUpdate au = new AccountUpdate();
Database.executeBatch(au,1500);
The limit for scope parameter is 2000.
The default value is 200.
If the scope value is greater than 2000, it will consider as 2000 and then process.
Cheers!!!
How to add help text or help bubble in Visualforce page?
Sample Code:
Visualforce page:
<apex:page sidebar="false" Controller="Sample" showHeader="true">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem helpText="Name of the Account" LabelTitle="Account Name">
<apex:outputtext >Enter the Account Name</apex:outputtext>
<apex:inputtext value="{!Name}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Output:
Visualforce page:
<apex:page sidebar="false" Controller="Sample" showHeader="true">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem helpText="Name of the Account" LabelTitle="Account Name">
<apex:outputtext >Enter the Account Name</apex:outputtext>
<apex:inputtext value="{!Name}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Output:
What is the use of bucket field in Reports in Salesforce?
Bucket field in Reports in Salesforce is used to group values to the name we specify.
It can group only the below data types fields
1. Picklist
2. Number
3. Text
Lets see an example.
Report without bucket field:
Adding bucket field:
Grouping Chennai, Coimbatore and Vellore cities to Tamilnadu and grouping Hydrebad and Nellore to Andhrapradesh:
Ouput:
It can group only the below data types fields
1. Picklist
2. Number
3. Text
Lets see an example.
Report without bucket field:
Adding bucket field:
Grouping Chennai, Coimbatore and Vellore cities to Tamilnadu and grouping Hydrebad and Nellore to Andhrapradesh:
Ouput:
Cheers!!!
How to display a custom button when checkbox is checked in Salesforce?
Sample code:
Visualforce page:
<apex:page controller="Sample" >
<apex:form >
<apex:pageBlock id="pg" >
<apex:pageblockSection >
<apex:pageblockSectionItem >Check it to view the button:</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:inputCheckbox value="{!option}" >
<apex:actionsupport event="onclick" action="{!change}" reRender="pg"/>
</apex:inputCheckbox>
</apex:pageblockSectionItem>
</apex:pageblockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Submit" rendered="{!bool}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Controller:
public class Sample
{
public Boolean option {get;set;}
public Boolean bool {get;set;}
public Sample()
{
bool = false;
}
public void change()
{
if(option == true)
{
bool = true;
}
else
{
bool = false;
}
}
}
Output:
Visualforce page:
<apex:page controller="Sample" >
<apex:form >
<apex:pageBlock id="pg" >
<apex:pageblockSection >
<apex:pageblockSectionItem >Check it to view the button:</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:inputCheckbox value="{!option}" >
<apex:actionsupport event="onclick" action="{!change}" reRender="pg"/>
</apex:inputCheckbox>
</apex:pageblockSectionItem>
</apex:pageblockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Submit" rendered="{!bool}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Controller:
public class Sample
{
public Boolean option {get;set;}
public Boolean bool {get;set;}
public Sample()
{
bool = false;
}
public void change()
{
if(option == true)
{
bool = true;
}
else
{
bool = false;
}
}
}
Output:
How to send picklist values from one VF page to another?
Sample codes:
First Page and its Controller:
<apex:page controller="Sample" >
<apex:form >
<apex:pageBlock >
<apex:pageblockSection >
<apex:pageblockSectionItem >Select the value to pass:</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!option}" >
<apex:selectOption itemValue="red" itemLabel="Red"/>
<apex:selectOption itemValue="green" itemLabel="Green"/>
<apex:selectOption itemValue="blue" itemLabel="Blue"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Pass this" action="{!pass}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Sample
{
public String option {get;set;}
public pageReference pass()
{
PageReference pg = new PageReference('/apex/Sample1?val=' + option);
pg.setRedirect(true);
return pg;
}
}
Second Page and its Controller:
<apex:page controller="Sample1" >
The received value is {!option}
</apex:page>
public class Sample1
{
public String option {get;set;}
public Sample1()
{
option = ApexPages.currentPage().getParameters().get('val');
}
}
Output:
First Page and its Controller:
<apex:page controller="Sample" >
<apex:form >
<apex:pageBlock >
<apex:pageblockSection >
<apex:pageblockSectionItem >Select the value to pass:</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!option}" >
<apex:selectOption itemValue="red" itemLabel="Red"/>
<apex:selectOption itemValue="green" itemLabel="Green"/>
<apex:selectOption itemValue="blue" itemLabel="Blue"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Pass this" action="{!pass}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Sample
{
public String option {get;set;}
public pageReference pass()
{
PageReference pg = new PageReference('/apex/Sample1?val=' + option);
pg.setRedirect(true);
return pg;
}
}
Second Page and its Controller:
<apex:page controller="Sample1" >
The received value is {!option}
</apex:page>
public class Sample1
{
public String option {get;set;}
public Sample1()
{
option = ApexPages.currentPage().getParameters().get('val');
}
}
Output:
How to add Chart to the Report in Salesforce?
1. Open the report.
2. Click "Customize" button to edit the Report.
3. Click "Add Chart" button.
4. Select Chart type.
5. Select X-axis.
6. Select Y- axis.
7. Check "Plot additional values" check box in Combination Charts for additional field to plot in the chart.
8. Select Line or Column in Display.
9. When adding a line to a vertical column chart, select Use second axis to show a separate axis for the added line on the right side of the column chart. A separate axis can be useful when the two values have different ranges or units.
10. If it is "Column", we can add multiple columns.
11. Click formatting to decorate your Chart.
12. Click "Ok" button.
Sample Chart:
2. Click "Customize" button to edit the Report.
3. Click "Add Chart" button.
4. Select Chart type.
5. Select X-axis.
6. Select Y- axis.
7. Check "Plot additional values" check box in Combination Charts for additional field to plot in the chart.
8. Select Line or Column in Display.
9. When adding a line to a vertical column chart, select Use second axis to show a separate axis for the added line on the right side of the column chart. A separate axis can be useful when the two values have different ranges or units.
10. If it is "Column", we can add multiple columns.
11. Click formatting to decorate your Chart.
12. Click "Ok" button.
Sample Chart:
Document for Reports in Salesforce
Check this link for document for Reports in Salesforce
http://www.salesforce.com/us/developer/docs/workbook_analytics/workbook_analytics.pdf
Cheers!!!
http://www.salesforce.com/us/developer/docs/workbook_analytics/workbook_analytics.pdf
Cheers!!!
What is the use of Deployment Status while creating an object in Salesforce?
If it is "Deployed", then other users also can see it.
If it is "In Development", then other users cannot see it.
Cheers!!!
If it is "In Development", then other users cannot see it.
Cheers!!!
What is the use of Web Tab in Salesforce?
Web tab is used to have generic link in our organization.
For example, company's intranet.
Check the below link for creating one
https://www.infallibletechie.com/2014/02/1.html
For example, company's intranet.
Check the below link for creating one
https://www.infallibletechie.com/2014/02/1.html
Salesforce Interview questions with answers Part 2
1. In which object all Approval process are stored?
Approval
2. In which object all email templates are saved?
EmailTemplate
3. In which object all Account Team Members are added?
AccountTeamMember
4. In which object all salesforce objects are saved?
sObject
5. In which object all Opportunity Team Members are added?
OpportunityTeamMember
6. List out all the tables in salesforce?
https://sites.google.com/site/infallibletechie/standard-objects-in-salesforce
7. In Which object all Apex Pages are stored?
ApexPage
8. In Which object all Apex Triggers are stored?
ApexTrigger
9. In Which object all Apex Classes are stored?
ApexClass
10. Where Products are added?
Product2
11. In which object workflows are stored?
Workflow
12. In which object Roles are stored?
UserRole
Approval
2. In which object all email templates are saved?
EmailTemplate
3. In which object all Account Team Members are added?
AccountTeamMember
4. In which object all salesforce objects are saved?
sObject
5. In which object all Opportunity Team Members are added?
OpportunityTeamMember
6. List out all the tables in salesforce?
https://sites.google.com/site/infallibletechie/standard-objects-in-salesforce
7. In Which object all Apex Pages are stored?
ApexPage
8. In Which object all Apex Triggers are stored?
ApexTrigger
9. In Which object all Apex Classes are stored?
ApexClass
10. Where Products are added?
Product2
11. In which object workflows are stored?
Workflow
12. In which object Roles are stored?
UserRole
What is the use of Search Results layout in Search layouts?
Search Results layout in Search layouts is used to display fields for users in search results.
If the user's profile has "Customize Application" permission, then the user can edit Search Layouts.
Sample search result:
When editing a search results layout for an object, you can select the Override the search result column customizations for all users checkbox. If selected, all user column customizations within your organization will be overwritten and set to the organization-wide default settings.
If the user's profile has "Customize Application" permission, then the user can edit Search Layouts.
Sample search result:
When editing a search results layout for an object, you can select the Override the search result column customizations for all users checkbox. If selected, all user column customizations within your organization will be overwritten and set to the organization-wide default settings.
How to remove none option on a picklist in Salesforce?
Vote for the below idea if the below workaround didn't work in your case.
To remove none option on a picklist in Salesforce, follow the below steps
1. Edit your page layout and make your picklist field a required field by clicking on the properties and checking "Required" check box.
2. Click "Ok" button.
3. Save the the changes to the page layout. This will remove the "-None-" as an option in the picklist.
Output:
1. Edit your page layout and make your picklist field a required field by clicking on the properties and checking "Required" check box.
2. Click "Ok" button.
3. Save the the changes to the page layout. This will remove the "-None-" as an option in the picklist.
Output:
Subscribe to:
Posts (Atom)