Wednesday, July 23, 2014

What is StandardSetController Class?

What is StandardSetController Class?


StandardSetController objects allow you to create list controllers similar to, or as extensions of, the pre-built Visualforce list controllers provided by Salesforce.

Instantiation of Standardset Controller is 

You can instantiate a StandardSetController in either of the following ways:

From a list of sObjects:

List<account> accountList = [SELECT Name FROM Account LIMIT 20];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(accountList);

From a query locator:

ApexPages.StandardSetController ssc = 
new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Name,CloseDate FROM Opportunity]));

StandardSetController Methods

The following are methods for StandardSetController. All are instance methods.

cancel() 
Returns the PageReference of the original page, if known, or the home page.

first() 
Returns the first page of records.

getCompleteResult() 
Indicates whether there are more records in the set than the maximum record limit. If this is false, there are more records than you can process using the list controller. The maximum record limit is 10,000 records.

getFilterId() 
Returns the ID of the filter that is currently in context.

getHasNext() 
Indicates whether there are more records after the current page set.

getHasPrevious() 
Indicates whether there are more records before the current page set.

getListViewOptions() 
Returns a list of the listviews available to the current user.

getPageNumber() 
Returns the page number of the current page set. Note that the first page returns 1.

getPageSize() 
Returns the number of records included in each page set.

getRecord() 
Returns the sObject that represents the changes to the selected records. This retrieves the prototype object contained within the class, and is used for performing mass updates.

getRecords() 
Returns the list of sObjects in the current page set. This list is immutable, i.e. you can't call clear() on it.

getResultSize() 
Returns the number of records in the set.

getSelected() 
Returns the list of sObjects that have been selected.

last() 
Returns the last page of records.

next() 
Returns the next page of records.

previous() 
Returns the previous page of records.

save() 
Inserts new records or updates existing records that have been changed. After this operation is finished, it returns a PageReference to the original page, if known, or the home page.

setFilterID(String) 
Sets the filter ID of the controller.

setpageNumber(Integer) 
Sets the page number.

setPageSize(Integer) 
Sets the number of records in each page set.

setSelected(sObject[]) 
Set the selected records.




Simple Visualforce Pagination Example Using Standaredset Controller.

Simple Visualforce Pagination Example Using Standaredset Controller.

Hi,
In this post i am giving a simple example of visualforce pagination using standardset controller.

Visualforce Page:
<apex:page controller="opportunityListCon">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!Opportunities}" var="o">
                <apex:column value="{!o.name}"/>
                <apex:column value="{!o.closedate}"/>
            </apex:pageBlockTable>
           
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="first" action="{!setCon.first}"/>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputText>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="next" action="{!setCon.next}"/>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="last" action="{!setCon.last}"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Controller  Class:
public class opportunityListCon {
  // ApexPages.StandardSetController must be instantiated   
  // for standard list controllers       
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select name,closedate from Opportunity]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
   
    public List<Opportunity> getOpportunities() {
         setCon.setpagesize(5);
         return (List<Opportunity>) setCon.getRecords();
    }
   
}

Output:
save image








Docusign for Salesforce Video.

Docusign for Salesforce Video.


In this video link you can get some what idea of Docu sign for salesforce integration.


Tuesday, July 22, 2014

Visualforce Email Template with custom controller.

Visualforce Email Template with custom controller?

Apex Controller:

public  class acctTemplt
{
    public Id accountId {get;set;}
    public List<Opportunity> getopptys()
    {
        List<Opportunity> oppty;
        oppty = [SELECT Name, StageName FROM Opportunity WHERE Accountid =: accountId];
        return oppty;
    }
}


Component:

Name:OpptyList

<apex:component controller="acctTemplt" access="global">
    <apex:attribute name="AcctId" type="Id" description="Id of the account" assignTo="{!accountId}"/>
    <table border = "2" cellspacing = "5">
        <tr>
            <td>Opportunity Name</td>
            <td>Opportunity Stage</td>               
        </tr>
        <apex:repeat value="{!opptys}" var="o">
        <tr>
            <td>{!o.Name}</td>
            <td>{!o.StageName}</td>             
        </tr>
        </apex:repeat>       
    </table>
</apex:component>


Visualforce Email template:


<messaging:emailTemplate subject="List of opportunity" recipientType="User" relatedToType="Account">
    <messaging:htmlEmailBody >
    Hi,<br/>
    Below is the list of opportunities for your account {!relatedTo.Name}.<br/><br/>
    <c:OpptyList AcctId="{!relatedTo.Id}" /><br/><br/>
    <b>Regards,</b><br/>
    {!recipient.FirstName}
    </messaging:htmlEmailBody>
</messaging:emailTemplate>


Output:









How to log a technical support ticket with salesforce.com.

How to log a technical support ticket with salesforce.com.

The salesforce.com Standard Success plan includes access to salesforce.com technical support with a 2-business-day response time for support cases logged via the Help & Training portal. Every Salesforce.com Foundation customer has access to a Standard Success plan.
To submit a technical support case, go to the Help and Training portal and click the “Contact Support” link located on the upper right hand side of the home page. Then click the “Open a Case” button.
help+train

htportal

button

Fill out the “Open a Case” form completely including the questions on business impact. To ensure the quickest answer to your question, include: details on exactly what you are trying to do and what you have tried;  details on any Apps that might be involved in your issue; and any other specifics that will help the technical support agent get your question routed the correct way. The details you provide will help salesforce.com prioritize your case.
When you click “Next” to submit the case form, you may see a list of suggested Knowledge articles related to your issue. If those articles don’t answer your question, and you still need to submit the case, click “Submit” and salesforce.com technical support will respond via email within 2 business days.
Once you submit a case through the Help and Training portal, salesforce.com uses what they call skills-based routing to ensure cases go to the right experts. They use a tiered model, so simple questions start at Tier-1 and progress based on case complexity.
For most issues, you can submit a case online using the Help & Training portal as described above.  The Help & Training portal is available 24×7.
mycases

In the rare case where you run into what we call a “Severity 1 critical production issue”  (eg. we have internet access, but no one can successfully login to our Salesforce ORG), please call 1-800-NOSOFTWARE to speak a representative directly. You can call Salesforce tech support during local business hours, five days a week.  The phone numbers are listed in the Help & Training portal.  Just click the “Contact Support” link to access the phone numbers. You might also want to check http://trust.salesforce.com/trust/status/ to check if salesforce.com is having issues on your instance (what instance am I on?).
To manage a technical support case, open the Help & Training portal and go to the “My Cases” gadget. Click on the View All Cases link. You’ll get a list of all your cases, and then you can select a case to see more details.
To update the case,  click “New” on the case comments related list or attached a file using the attach a file button.
casecomments
The Standard Success plan is for organizations that need standard guidance in getting started with Salesforce. If you need a faster response, 24×7 support coverage, and a comprehensive training solution, we recommend a Premier Success plan. The Foundation offers Premier Success at a deep discount to our customers. To inquire about pricing for Premier Success, please call 1-800-NOSOFTWARE and ask to talk to your Account Executive.


What is cloud computing?

What is cloud computing?


Cloud computing services are evolving like anything. Companies of all sizes are adapting to the cloud computing technology. Cloud technology could either be private or public. There are 3 models that are fundamentally used in cloud computing

1. Platform as a service 
2. Infrastructure as a service  
3. software as a service 

There is 99% chance that you as an individual have already used cloud computing. If you have an web based mail account hosted by gmail, yahoo, hotmail etc or if you have a facebook account, picasa account then you have already experienced cloud computing. Instead of storing the mails on your computer you store them some where else, you use a browser to connect to the Internet and access the mails.The software and storage for your account doesn't exist on your computer. It is with the cloud computing




service provider company. You as an user simply access the services in cloud with your computer and an interface software which could be a simple browser. But, in the back end there are various computers, servers and data storing systems that create the whole cloud computing system.

Moving to cloud means storing your data files on a remotely located servers, using web based application online not installed on your personal computer. The only thing you will need to access the services of cloud computing is the software Interface that connects you with  cloud computing services this could be a simple browser, rest of the things are taken care of by service providers network. 

With advancement in the cloud technology the applications of cloud computing are turning to be practically limitless. Cloud computing can execute all the programs you could run on your personal normal computer. Maintenance of cloud computing applications is easier, because they do not need to be installed on user's computer and can be accessed from any location.

Any cloud computing company generally has quite a large number of clients, thus they need to have a large amount of digital space to store all the client data. They have to also make sure they create duplicate copies of the data as a back up in case of any break down. Cloud computing service providers offer their services according to below 3 fundamental models:

1. Infrastructure As A Service (IaaS)
This is a raw model which includes offering storage and computing resources which can be used by software developers for building business solutions. IT organisations can deliver solutions for their clients using IAAS model. Cloud users can install their operating system and their applications on the cloud infrastructure.
Example of the companies that provide IAAS are amazon EC2, google compute engine, hp cloud

2. Platform As A Service (PaaS)
This model gives a computing platform on top of which you can build a application as desired. The platform can include operating system, programming language execution service, database and server. Service provider could offer a developer tool which can be used to build services or database services or data storage services on the provided platform. Developers can build an application on this platform without bothering about the underlying hardware and software layers.
Example of PAAS service providers are force.com, heroku, azure cloud services, google app engine.

3. Software As A Service (SaaS)
In this type of model the service provider gives a specific built

application and supporting database. We can say that the application or the software is hosted by provider and you don't have to install anything from your side. You have to just connect using internet to use the application service. An example of application service is CRM or ERP. SAAS delivers single application through the browser to number of customers using a multitenant architecture environment. Salesforce.com is a Best known example of SAAS, that provides CRM application built on force.com. Other examples of SAAS are google apps, microsoft office 365.
















Advantages of cloud computing
1. As an user you don't store anything on your computer, so you are not bothered about installing anything or perhaps maintain anything personally.
2. Low cost. Maintenance cost, installation cost are reduced.
3. Easy access, you can access the services (applications and data) easily using software    interface like browser. You only need to be connected to the Internet.
4. Access data from anywhere irrespective of your location as long as you have a computer    and an Internet connection
5. Brings the hardware costs down
6. Clients can access their data from anywhere at any time.
7. Reduces the need for advanced hardware on the client side
8. Data storage requires physical space, with cloud computing you are not bothered about    physical space and its security. Cloud computing service provider takes care of this.
9. Data recovery and backup.
10. Streamlines the business processes.
11. Globalization, employees can access same services irrespective of their location


Disadvantages of Cloud Computing
1. Security could be one concern as the data resides with the service providers.

2. Privacy of data is other concern.




Sunday, July 20, 2014

SalesForce.com Icons Available for Use.

SalesForce.com Icons Available for Use

Hi,
You can save these images into your salesforce org and you can use.








Saturday, July 19, 2014

Confirm Dialog box in Visualforce.

Confirm Dialog box in Visualforce

Hi,
Here is the example that you can use confirm dialog in Visualforce page.

Visualforce Page:

<apex:page tabstyle="account">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection title="Confirm dialog Demo" collpsible="true">
            <apex:outputText> please click on button to populate confirm dialog</apex:outputText>
                 <apex:commandButton value="click to confirm" onclick="return confirm('are you want to submit');"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
      
    </apex:form>
</apex:page>








Friday, July 18, 2014

What is the Difference between Roles and Profiles in salesforce?

What is the Difference between Roles and Profiles in salesforce?

Roles

In salesforce, roles are defined so as to increase the data visibility a particular user has. The data visibility can be increased using sharing rules or by building role hierarchy. Role hierarchy allows the user sitting in higher level have access of records owned by users having role lower in hierarchy. It is not mandatory that a user should have a role.

Organisation wide default sets the default access for objects, for example OWD set as private would mean that only the owner of the record can access the record. One way to grant additional access of these records to other users is through roles i.e users higher in role hierarchy would get the access of records owned by users lower in hierarchy. Other way is by writing sharing rules, wherein we can specify the logic to decide which record should be shared and with what role user. We can specify against custom objects whether the records should be shared using role hierarchy or not but this is default set for standard objects and cannot be changed. That is, standard object records will always be shared according to role hierarchy. Defining role for users is not a mandatory thing, however not defining role for a user could affect the data shown on opportunity and other reports for that user.
Summarizing the points for role,

1. Role controls the level of record access user has
2. Helps extend the OWD settings for different objects
3. Sharing rules can be written to share records with particular role and subordinates
4. Defining role for user is not mandatory. 


Profiles

Unlike role,  profile is mandatory for every user in salesforce. You cannot have a user without a profile. It is the building pillar of the entire org. Profile states the objects/field permissions and also other permissions with in the org. It defines what a user can do within the org, it states the access settings and user permissions. Profile controls following -
  • Object permissions [create, delete,read, edit permissions] 
  • field permissions [view, edit]
  • Record type permission 
  • Which Apps can be viewed 
  • Login hours can be defined 
  • IP address permissions 
  • Which tabs are visible 
  • Which page layouts can be viewed  
  • Classes, vf pages permissions
Salesforce provides some standard profiles with different set of permissions for each, we can create our own profiles to have permissions as per our requirement. New profile should be cloned from existing profile.

Difference between the two can be summarized as below

1. Role defines what user can see depending on the hierarchy(Helps in defining data visibility)
2. Profile defines what a user can do within the org(Defines various permissions)
3. Defining profile for a user is mandatory, role is not.











Simple Pagination Example in Visualforce.

Simple Pagination Example in Visualforce.


Hi,
In this post i am writing simple pagenation example on Account object, Here i am using a controller class.

Controller Class :

public class AccountPaginationController {

public ApexPages.StandardSetController stCon{
 get{
   if(stCon == null){ 
     stCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select id,Name,Phone from Account order by Name limit 1000]));
     stCon.setPageSize(5);        
   }
   return stCon;
 }
 set;
}

//method.
 public List<Account> getAccoountList(){
        return (List<Account>)stCon.getRecords();
 }

public Boolean hasNext {
   get {
            return stCon.getHasNext();
     }
  set;
}

public Boolean hasPrevious {
    get {
       return stCon.getHasPrevious();
}
  set;
}

public Integer pageNumber {
        get {
            return stCon.getPageNumber();
        }
        set;
 }

 public void first() {
        stCon.first();
    }
   
    public void last() {
        stCon.last();
    }

    public void previous() {
        stCon.previous();
    }
    
    public void next() {
        stCon.next();
    }
  
    public void cancel() {
        stCon.cancel();
    }


}


Visualforce Page :

<apex:page controller="AccountPaginationController">
  <apex:form >
   <apex:pageblock >
    <apex:pageblockSection title="Account Results - Page #{!pageNumber}" columns="1" >
     <apex:pageblockTable value="{!AccoountList}" var="a">
       <apex:column value="{!a.Name}"/>
       <apex:column value="{!a.phone}"/>
     </apex:pageblockTable> 
     
      <apex:panelGrid columns="4">
       <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
        <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
        <apex:commandLink action="{!last}">Last</apex:commandlink>
      </apex:panelGrid>
    
    </apex:pageblockSection>   
   </apex:pageblock>  
  </apex:form>
</apex:page>


Output:






That's it..

The Importance of Customer Relationship.

The Importance of Customer Relationship.

Hi, 
You can get the clear idea of what exactly Customer Relationship Management (CRM) is in the below link.

http://www.openlearningworld.com/books/CRM/The%20Importance%20of%20Customer%20Relationship/index.html




 
| ,