Friday, August 22, 2014

27) Field Accessibility in Salesforce

1. Go to Setup --> Administration Setup --> Security controls --> Field Accessibility.


2. Select the object.

3. Choose your view.

View by Fields

Use this option to choose a field and view a table of field accessibility for different profiles and record types.



4)View by Profiles
Use this option to choose a profile and view a table of field accessibility for different record types.



26)How to fetch data from Controller and display it in Visualforce page without using button?

To fetch data from Controller and display it in Visualforce page without using button, retrieve the record in the constructor.

Sample code:

Visualforce page:

<apex:page controller="Sample" >
    <apex:form >
       <apex:pageblock id="account" title="Account Details(Standard Object)" >
            <apex:pageblockTable value="{!acc}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.AccountNumber}"/>
            </apex:pageblockTable>
        </apex:pageblock>
       <apex:pageblock id="member" title="Member Details(Custom Object)">
            <apex:pageblockTable value="{!mem}" var="m">
                <apex:column value="{!m.Name}"/>
            </apex:pageblockTable>        
        </apex:pageblock>          
    </apex:form>
</apex:page>

Controller:

public with Sharing class Sample
{  
    public List<Account> acc {get;set;}
    public List<Member__c> mem {get;set;}  
     
    public sample()
    {
        acc = [SELECT Name, AccountNumber FROM Account];
        mem = [SELECT Name FROM Member__c];
    }
}


25) How to disable textbox in Visual force page based on Picklist values

Sample code:

Visualforce page:

<apex:page controller="Sample">
<apex:form >
<apex:actionFunction name="changeBoolCall" action="{!changeBool}"/>
    <apex:pageblock id="pg">
        <apex:pageblockSection >
            <apex:pageblockSectionItem >
                Select currency :
            </apex:pageblockSectionItem>
            <apex:pageblockSectionItem >
               <apex:selectList value="{!curency}" size="1" multiselect="false">
                   <apex:selectOption itemLabel="--- None ---" itemValue="none"/>
                   <apex:selectOption itemLabel="Indian Rupee" itemValue="inr"/>
                   <apex:actionSupport event="onchange" action="{!changeBool}" reRender="pg"/>
               </apex:selectList>
            </apex:pageblockSectionItem>          
            <apex:pageblockSectionItem >
                Enter the amount:
            </apex:pageblockSectionItem>    
            <apex:pageblockSectionItem >
               <apex:inputtext value="{!amount}" disabled="{!curencyBool}"/>
            </apex:pageblockSectionItem>                  
        </apex:pageblockSection>
    </apex:pageblock>
</apex:form>  
</apex:page>

Apex Controller:

public class Sample
{
    public String curency {get;set;}
    public String amount {get;set;}
    public Boolean curencyBool {get;set;}
   
    public sample()
    {      
        curency = 'none';
        if(curency == 'none')
        {
         curencyBool = true;
        }  
    }
   
    public void changeBool()
    {      
        if(curency != 'none')
        {
            curencyBool = false;
        }
        else
        {
            curencyBool = true;
        }
    }
     
}

24) Force.com Migration tool

The Force.com Migration Tool is a Java/Ant-based command-line utility for moving metadata between a local directory and a Salesforce organization.

The Force.com Migration Tool is especially useful in the following scenarios:
• Development projects where you need to populate a test environment with large amounts of setup changes
• Multistage release processes
• Repetitive deployment using the same parameters
• When migrating from stage to production is done by IT

Link for more information,

http://www.salesforce.com/us/developer/docs/daas/salesforce_migration_guide.pdf

Tuesday, August 19, 2014

23) How to check my Salesforce release

Since Salesforce.com is on cloud and sharing infrastructure with customers using Salesforce, users in the same instance will run the same version / release. See his blog for more information on sandbox - Salesforce Release and Sandbox

1) you can see the logo of the home page.


2) on the home page click on discover button and see the features of the release of that version.



22) How to Check your Salesforce instance

1) URL



  • In screenshot above this is ap1 instance.
  • while production instance for America instances start with NA, APAC instances start with AP, and EMEA instances start with EU
  •  Sandbox instance always start with CS
  • click here to see more instances
  • you want to know which instance your using simply click the link  in the link you have to mention the domain name and click on find button. 
2) SOQL : SELECT InstanceName, IsSandbox FROM Organization


21) How many salesforce editions are there

List of editions from (lower to higher)


  1. Contact Manager
  2. Group
  3. Professional
  4. Enterprise (included Developer edition)
  5. Unlimited 
  6. Performance
Remember you can upgrade from one edition to 'higher' edition using the same instance, but not to downgrade, for some reason when you opt-to downgrade, Salesforce will provide you new instance and you need to manually migrate all configuration and data, which is very troublesome

20) How to check my salesforce edition ?

There are few ways to do this

1. Setup-Administration setup



2. Hover your mouse over web browser
Once you have login to Salesforce, hover your mouse over the web browser tab.

In Google Chrome & Mozilla fire fox should be same.




Wednesday, August 13, 2014

19) Listbox using visualforce

<apex:page Controller="Listbox">
<apex:form >
<left>
<apex:pageBlock >
<b>Category:&nbsp;&nbsp;</b>
<apex:selectList value="{!ctgry}" size="1">
<apex:selectOptions value="{!ctgrys}"/>
</apex:selectList>  
</apex:pageBlock>
</left>
</apex:form> 
</apex:page>

public class Listbox
{

    public String[] ctgry = new String[]{};
 
    public Listbox()
    {

    }
 
    public List<SelectOption> getCtgrys()
    {  
      List<SelectOption> options = new List<SelectOption>();
      options.add(new SelectOption('India','India'));
      options.add(new SelectOption('CANADA','Canada'));
      options.add(new SelectOption('United States','US'));
      return options;
    }
 
    public String[] getCtgry()
    {
      return ctgry;
    }
 
    public void setCtgry(String[] ctgry)
    {
    this.ctgry = ctgry;
    }  

}


18) Disabling Sidebar using Visualforce

Hi All,
First the Visualforce page shows along with the sidebar
<apex:page>
</apex:page>


After then the sidebar will be disable by simply writing one line of code

<apex:page sidebar="false">
</apex:page>
By clicking save button it seems like that


17) SFDC login URL

Hi All,

Just you can login to salesforce by simply clicking the below URL

https://login.salesforce.com/

After clicking the URL the salesforce login page will appear in your browser with the user name and password.


16) What is SFDC

Hi All,
Salesforce.com is a CRM. It is based on cloud computing

  • There is no need of software and hardware to be installed
  • Just a browser enough (with Internet connection)
  • Log with username and password like gmail.
  • Everything is done effectively in the cloud. From any where you can login and logout.
  • Database is maintained by SFDC itself which is an added advantage for us.

15) Standard fields in Salesforce

1.Created By
2. Last Modified By
3. Owner
4. CreatedDate
5. ModifiedDate

Monday, August 11, 2014

14) How is a pdf generated using visual force page.

You can render any page as a PDF by adding the renderAs attribute to the <apex:page> component, and specifying “pdf” as the rendering service

<apex:page renderAs="pdf">
Visualforce pages rendered as PDFs will either display in the browser or download as a PDF file, depending on your browser settings

For more information Click here

13) How to display error messages in the Visualforce page?

To display error messages in the Visualforce page add below tag where you want to display the error message.

Visualforce page:
<apex:pageMessages />

Apex Controller:
 ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.');
ApexPages.addMessage(myMsg);

(OR)

ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.'));

12) What is ApexPages.addMessage and what is package.xml?

Apexpages is  a class and Addmessge and Add messages are two method to show message from class to page.

ApexPages.addMessage: Add a message to the current page context. Use ApexPages to add and check for messages associated with the current page, as well as to reference the current page. In addition, ApexPages is used as a namespace for the Pagerefernce and Message classes.


The package.xml file, also known as the project manifest, is a control file that determines the set of metadata components
to retrieve or deploy in a project. In practice, it is much easier to use the Project Properties dialog to add or remove components
from a project—which modifies package.xml for you—but it is also possible to edit package.xml by hand.It holds complete schema of your org (like custom object, standard object, custom fields etc etc..). You can get more info in this PDF and also you can get some more information over this here

11) How can one read parameter values through the URL in Apex.

Hi,

If you have ID parameter in the  URL then try this apex code.

public Id oppid{get;set;}
Id id = apexpages.currentpage().getparameters().get('id');
 
If you want to read parameter in Visualforce the write in 
visualforce page :
<apex:inputField value="{!$CurrentPage.parameters.Paramtervalue}"/>

If you have to add a parameter to the URL the use
ApexPages.currentPage().getParameters().put(parameterName , value);