SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Leverage StandardSetController in
Apex and Visualforce
Developer Track 2012
Nebojsa (Nash) Zgonjanin, CRM Developer
OnPath Ottawa, Ontario, Canada (www.onpath.com)
Nebojsa.zgonjanin@onpath.com
@Nzgon
ca.linkedin.com/in/nashzgonjanin
Abstract

• Do you use list view filters?
• Would you like to use that same logic in your Visualforce
  pages?
• Don’t reinvent the wheel
• Save time, and make your admin happier as well
Nebojsa (Nash) Zgonjanin   CRM Developer
                           •   Salesforce MVP (winter 2012),
                           •   Salesforce developer more than 6 years,




                           •   Senior developer (MS .NET) more than
                               15 years,
                           •   Work for www.OnPath.com, Ottawa,
                               Ontario, Canada
Session Objectives

• StandardSetController and List View Filter Criteria (logic)
• jQuery Table Sort and Visualforce page
• Hierarchy Custom Setting used to control functionality per
  org (profile or user level)
• Demo ”Add to Campaigns” of implemented technology
Session Objectives

• Short live demo of application to
  familiarize audience with topic
• Use of Eclipse to browse code
  and point to key moments
• Code in PPT presentation is used
  as reference
Solution Intro I

• StandardSetController and List View Filter Criteria
• Define StandardSetController (SOQL query)
• Apply Filter Criteria from List View to StandardSetController
• Execute SOQL and use in Apex code
Solution Intro II
jQuery Table Sort and Visualforce Page
• jQuery Setting
    • Static resources
    • <apex:includeScript>
• Mash up of:
    • standard HTML table tags
    • <apex:repeat> tag
    • jQuery <script> code
Solution Intro III

Hierarchy Custom Settings (Levels of use)
• Org default
• Profile (group of users)
• User (individual)
• Use of setting values in Apex code
• Use of setting values in Visual Force page
• Demo: User (Serbian) vs. Org Default (English)
Nash
    Code sample (package) available here:
https://github.com/nzgonjanin/Dreamforce2012
                  Thank You
Nebojsa (Nash) Zgonjanin, CRM Developer

OnPath Ottawa, Ontario, Canada (www.onpath.com)
Nebojsa.zgonjanin@onpath.com

@Nzgon
ca.linkedin.com/in/nashzgonjanin
Solution intro
       I always wanted to leverage platform functionality and add
more of client side functionality that browser bring in game.
       Combination of APEX controller extension and standard
controllers (ApexPages.StandardController and
ApexPages.StandardSetController) give me option to leverage standard
platform functionality and add more flexibility and user interface
functionality to Visual Force page using jQuery Table sorter
(jquery.tablesorter.min.js) add on, that enable sorting of multiple
columns.

        Using Custom setting I made available different set of
parameters to be used per Org; Profile or User (labels, list views for
filtering, Error Messages…) that enable easy internationalization if
needed.
Objectives and Solution I
                    What is the Add to Campaigns app
        Salesforce.com provides features for adding many people to a
single campaign, but what about an organization that manages
multiple, ongoing campaigns like newsletters, customer programs,
annual events, and even holiday card lists?
        Manually adding a single person to multiple campaigns one by
one is a pain, and contributes to poor adoption, and incomplete or
unusable data.
        This app application in salesforce.com allows users to add a
single contact or lead to multiple campaigns with as few clicks as
possible.
Objectives and Solution II
 There are two portions to this application: end-user and administrator (non-developer).
        NOTE: Custom Settings, Standard List View filter, Standard Controller,
StandardSetController are used to give end user (administrator) flexibility to manage data
set used for app in combination with visual force page
ADDTOCAMPAIGNS_LISTVIEWFILTER or using standard List View management under
Campaigns tab.

         The end-user portion of the application works the same for both contacts and
leads. Add a custom button to the Campaign History related list for both Leads and
Contacts called "Add to Campaigns". When the end-user clicks this button display a list of
campaigns with check boxes and a "check all" option. (The query for the list of campaigns
will be determined in the administrator portion of the application.) When the end-user
submits the form, insert the contact/lead to the campaign as member with the default
status for that campaign and return the user back to the standard contact/lead details
page.
APEX controller extension
                              (addtocampaigns_Extension.cls I )
public with sharing class addtocampaigns_Extension {

//variables used on Visual force page for interaction with end user
public Lead ParticipantLead {get; set;} //Lead record returned based on Id (pid) query parameter from custom button
public Contact ParticipantContact {get; set;} //Contact record returned based on Id (pid) query parameter from custom
button
public string ParticipantId {get;set;} //Value of Query parameter pid
public list<addtocampaigns_Wrapper> Campaign_List=new list<addtocampaigns_Wrapper>(); //List of campaign records
to be used for selection
public Boolean SubmitDisabled {get;set;} //[Submit] button and [Select All] button can be used just ones
public AddtoCampaignsSetting__c mySetting {get; set;} //Custom Setting for logged user

public addtocampaigns_Extension(ApexPages.StandardController controller) {
    //Standard controller extensin used to add custom functionality to visual force page
    ParticipantId=System.currentPageReference().getParameters().get('pid');
    mySetting=AddtoCampaignsSetting__c.getInstance();//Custom Setting Definitions
    getParticipant(); //get Participant data from Lead or Contact
    getCampaign_List();//get list for campaign selection
}
APEX controller extension
public ApexPages.StandardSetController con {
                                                (addtocampaigns_Extension.cls II)
    //Standard Set controller used to add custom functionality to visual force page
    //and leverage standard behavior of List View filters
    get {
       if(con == null) {
          //Standard set controller query used to retrieve data from Campaign object
          //used on visual force page to select potential campaigns
          integer myLimit=integer.valueOf(mySetting.RecordSet_Limit__c);
          if (myLimit==null){
              myLimit=200;
          }
          con = new ApexPages.StandardSetController(Database.getQueryLocator(
              [Select Id, Name, StartDate,EndDate, Type, Status, ParentId, RecordTypeId
                FROM Campaign
                order By Name,StartDate
                limit :myLimit]));

           //in order to use it again you need to refresh page or go back to participant and start again
           //set filter id that is applied for Hierarchy setting Org/Profile/User
           if (mySetting.ListViewId__c!=null){
                //Filter Magic is heppening here
             con.setPageSize(myLimit);
             con.setFilterID(mySetting.ListViewId__c);
             }
      }
      return con;
    }
    set;
}
APEX controller extension
//Queried data set is used to laverage data set
                                                           (addtocampaigns_Extension.cls III)
public List<addtocampaigns_Wrapper> getCampaign_List() {
  //get list for campaign selection
  if (Campaign_List.Size()==0){
      //Load campign list just ones on first page load
      //(List<Campaign>)con.getRecords()) will execute query and
      //apply defined mySetting.ListViewId__c as filter to set of records
      for (Campaign camp: (List<Campaign>)con.getRecords()){
        Campaign_List.add(new addtocampaigns_Wrapper(camp));

          //check if participant is already part of campaign and disable it for selection
          if (ParticipantId.startsWith('00Q')){
              //process lead campaign member records
              for (CampaignMember CM :ParticipantLead.CampaignMembers){
                if (CM.CampaignId==camp.Id && Campaign_List.Size()>0){
                    //disable check box on visual force page
                    Campaign_List[Campaign_List.size()-1].disabled=true;
                    break;
                }
              }
          }else{
              //process contact campaign member records
              for (CampaignMember CM :ParticipantContact.CampaignMembers){
                if (CM.CampaignId==camp.Id && Campaign_List.Size()>0){
                    //disable check box on visual force page
                    Campaign_List[Campaign_List.size()-1].disabled=true;
                    break;
                }
              }
          }
      }
    }
    return Campaign_List;
}
Addtocampaigns_Wrapper.cls
                                                (used in APEX controller extension to support app functionality)
public with sharing class addtocampaigns_Wrapper {

            //variables used for creating add to Campaigns record
            public String message{ get; set; } //success message
            public Boolean checked{ get; set; } //check box for selection
            public Boolean disabled {get; set;} //if member is alread part of campaign selection check box is disabled
  public Campaign camp { get; set;} //Campaign record returned as part of data set driven by listView filter

  public addtocampaigns_Wrapper(){
             //constructor without passed parameters
    camp = new Campaign();
    checked = false;
    disabled = false;
    message='';
  }

             public addtocampaigns_Wrapper(Campaign c){
                          //constructor with passed parameters
    camp = c;
    checked = false;
    disabled = false;
    message='';
   }
}//end of class
Visual Force Page code overview
                   (addtocampaigns_ListViewFilter.page)

<apex:page standardController="Campaign"
  tabStyle="Campaign" standardStylesheets="true">
  <apex:sectionHeader title="Cloudspokes"
        subtitle="{!$Setup.AddtoCampaignsSetting__c.Header_Subtitle__c}"/>
  <apex:enhancedList height="300" rowsPerPage="100"
        listId="{!$Setup.AddtoCampaignsSetting__c.ListViewId__c}"
        id="CampaignsList" customizable="True" />
</apex:page>
Visual Force Page code overview
                                               (addtocampaigns.page I)
<apex:page standardController="Campaign" extensions="addtocampaigns_Extension"
   tabStyle="Campaign" standardStylesheets="true">
   <!-- jQuery plug in for table sort my multiple columns -->
   <apex:includeScript value="{!URLFOR($Resource.jQuery_TableSort, 'jquery-latest.js')}" />
   <apex:includeScript value="{!URLFOR($Resource.jQuery_TableSort, 'jquery.tablesorter.min.js')}" />
   <apex:stylesheet value="{!URLFOR($Resource.jQuery_TableSort , '/themes/blue/style.css')}" />
<script>
$j = jQuery.noConflict();
$j(document).ready(function()
  {
     $j("#myTable").tablesorter( {sortList: [[1,0], [2,1]]} );
  }
 );
</script>
   <apex:sectionHeader title="Cloudspokes" subtitle="{!$Setup.AddtoCampaignsSetting__c.Header_Subtitle__c}"/>
  <apex:form >
  <apex:pageBlock id="CampaignMember" mode="detail">
   <apex:pageBlockButtons >
     <apex:commandButton id="Back" action="{!GoToParticipant}“ value="{!$Setup.AddtoCampaignsSetting__c.button_Back_Label__c}" />
     <apex:commandButton id="SelectAll" action="{!SelectAll}"                value="{!$Setup.AddtoCampaignsSetting__c.button_SelectAll_Label__c}"
       disabled="{!SubmitDisabled}"/>
     <apex:commandButton id="Submit" action="{!Submit}" value="{!$Setup.AddtoCampaignsSetting__c.button_Submit_Label__c}"
       styleClass="btnImportant" disabled="{!SubmitDisabled}"/>
     <apex:commandLink id="FilterSetting" action="{!FilterSetting}" target="_blank"
       value="Filter Settings" />
Visual Force Page code overview
                                     (addtocampaigns.page II)
//Lead Section
    <apex:pageBlockSection title="{!$Setup.AddtoCampaignsSetting__c.pageBlockSection_Lead__c}"
      columns="2" showHeader="true" collapsible="false" rendered="{!if(ParticipantLead.Id==null,false,true)}">
      <apex:outputField id="LeadFirstName" value="{!ParticipantLead.FirstName}" />
      <apex:outputField id="LeadCompany" value="{!ParticipantLead.Company}" />
      <apex:outputField id="LeadLastName" value="{!ParticipantLead.LastName}" />
      <apex:outputField id="LeadEmail" value="{!ParticipantLead.Email}" />
    </apex:pageBlockSection>
//Contact section
    <apex:pageBlockSection title="{!$Setup.AddtoCampaignsSetting__c.pageBlockSection_Contact__c}"
      columns="2" showHeader="true" collapsible="false“ rendered="{!if(ParticipantContact.Id==null,false,true)}">
      <apex:outputField id="ContactFirstName" value="{!ParticipantContact.FirstName}" />
      <apex:outputField id="ContactCompany" value="{!ParticipantContact.Account.Name}" />
      <apex:outputField id="ContactLastName" value="{!ParticipantContact.LastName}" />
      <apex:outputField id="ContactEmail" value="{!ParticipantContact.Email}" />
    </apex:pageBlockSection>

//Select campaigns section that mix jQuery (client side) and APEX server side functionality
    <apex:pageBlockSection title="{!$Setup.AddtoCampaignsSetting__c.pageBlockSection_Campaigns__c}"
      columns="1" showHeader="true" >

    {!$Setup.AddtoCampaignsSetting__c.Note__c}
    </apex:pageBlockSection>
Visual Force Page code overview
                                              (addtocampaigns.page III)
//standard HTML table tags used with apex:repeat tag to obtain data set
<table id="myTable" class="tablesorter">
    <thead> //table headers
      <tr>
         <th>{!$Setup.AddtoCampaignsSetting__c.column_Select_Header__c}</th>
         <th>{!$Setup.AddtoCampaignsSetting__c.column_Name_Header__c}</th>
         <th>{!$Setup.AddtoCampaignsSetting__c.column_StartDate_Header__c}</th>
         <th>{!$Setup.AddtoCampaignsSetting__c.column_EndDate_Header__c}</th>
         <th>{!$Setup.AddtoCampaignsSetting__c.column_Type_Header__c}</th>
         <th>{!$Setup.AddtoCampaignsSetting__c.column_Status_Header__c}</th>
         <th>Parent</th>
         <th>Record Type</th>
      </tr>
    </thead>
    <tbody> //table rows (data set from list view)
      <apex:repeat value="{!Campaign_List}" var="Camp" id="theRepeat">
      <tr>
         <td> <apex:inputCheckbox id="Selected" value="{!Camp.checked}" disabled="{!Camp.disabled}"/></td>
         <td> <apex:outputField id="Name" value="{!Camp.Camp.Name}"/></td>
         <td> <apex:outputField id="StartDate" value="{!Camp.Camp.StartDate}"/></td>
         <td> <apex:outputField id="EndDate" value="{!Camp.Camp.EndDate}"/></td>
         <td> <apex:outputField id="Type" value="{!Camp.Camp.Type}"/></td>
         <td><apex:outputField id="Status" value="{!Camp.Camp.Status}"/></td>
         <td><apex:outputField id="Parent" value="{!Camp.Camp.ParentId}"/></td>
         <td><apex:outputField id="RecordType" value="{!Camp.Camp.RecordTypeId}"/></td>
      </tr>
Custom Setting Hierarchy type overview
Hierarchy Custom Settings: A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The hierarchy logic
checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. In the hierarchy, settings for an organization are
overridden by profile settings, which, in turn, are overridden by user settings.
https://na14.salesforce.com/help/doc/user_ed.jsp?loc=help&target=cs_manage_data.htm&section=integrate

Weitere ähnliche Inhalte

Was ist angesagt?

Webadi -a_sample_implementation
Webadi  -a_sample_implementationWebadi  -a_sample_implementation
Webadi -a_sample_implementationAshish Harbhajanka
 
Oracle Receivables R12
Oracle Receivables R12Oracle Receivables R12
Oracle Receivables R12Sarfaraz Ahmed
 
Technical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part IITechnical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part IIAshish Saxena
 
Wily introscope 7.1 installation guide
Wily introscope 7.1   installation guideWily introscope 7.1   installation guide
Wily introscope 7.1 installation guideImam Nurhadi
 
IBM Websphere concepts
IBM Websphere conceptsIBM Websphere concepts
IBM Websphere conceptsKuldeep Saxena
 
Domains in IBM Maximo Asset Management
Domains in IBM Maximo Asset ManagementDomains in IBM Maximo Asset Management
Domains in IBM Maximo Asset ManagementRobert Zientara
 
Collaborate 15 White Paper Implementing Oracle Fusion Payroll
Collaborate 15 White Paper Implementing Oracle Fusion PayrollCollaborate 15 White Paper Implementing Oracle Fusion Payroll
Collaborate 15 White Paper Implementing Oracle Fusion PayrollWilliam Stratton
 
Personalization how to restrict transaction type list of values
Personalization how to restrict transaction type list of valuesPersonalization how to restrict transaction type list of values
Personalization how to restrict transaction type list of valuesAhmed Elshayeb
 
Using Aura component with custom list button
Using Aura component with custom list buttonUsing Aura component with custom list button
Using Aura component with custom list buttonInder Waraich
 
Hr profile option
Hr profile optionHr profile option
Hr profile optionFeras Ahmad
 
Secure Salesforce: Secret Storage in Your Salesforce Instance
Secure Salesforce: Secret Storage in Your Salesforce InstanceSecure Salesforce: Secret Storage in Your Salesforce Instance
Secure Salesforce: Secret Storage in Your Salesforce InstanceSalesforce Developers
 
Migration & upgrades best practice upgrade pathways to emc documentum 7
Migration & upgrades   best practice upgrade pathways to emc documentum 7Migration & upgrades   best practice upgrade pathways to emc documentum 7
Migration & upgrades best practice upgrade pathways to emc documentum 7Haytham Ghandour
 
OOW15 - personalize and extend oracle ebs for desktops and tablets
OOW15 - personalize and extend oracle ebs for desktops and tabletsOOW15 - personalize and extend oracle ebs for desktops and tablets
OOW15 - personalize and extend oracle ebs for desktops and tabletsvasuballa
 

Was ist angesagt? (20)

Basics of oracle service contracts
Basics of oracle service contractsBasics of oracle service contracts
Basics of oracle service contracts
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 
Webadi -a_sample_implementation
Webadi  -a_sample_implementationWebadi  -a_sample_implementation
Webadi -a_sample_implementation
 
Oracle Receivables R12
Oracle Receivables R12Oracle Receivables R12
Oracle Receivables R12
 
Technical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part IITechnical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part II
 
Wily introscope 7.1 installation guide
Wily introscope 7.1   installation guideWily introscope 7.1   installation guide
Wily introscope 7.1 installation guide
 
CQRS and Event Sourcing with Axon Framework
CQRS and Event Sourcing with Axon FrameworkCQRS and Event Sourcing with Axon Framework
CQRS and Event Sourcing with Axon Framework
 
Oracle alert
Oracle alertOracle alert
Oracle alert
 
IBM Websphere concepts
IBM Websphere conceptsIBM Websphere concepts
IBM Websphere concepts
 
Domains in IBM Maximo Asset Management
Domains in IBM Maximo Asset ManagementDomains in IBM Maximo Asset Management
Domains in IBM Maximo Asset Management
 
Collaborate 15 White Paper Implementing Oracle Fusion Payroll
Collaborate 15 White Paper Implementing Oracle Fusion PayrollCollaborate 15 White Paper Implementing Oracle Fusion Payroll
Collaborate 15 White Paper Implementing Oracle Fusion Payroll
 
Personalization how to restrict transaction type list of values
Personalization how to restrict transaction type list of valuesPersonalization how to restrict transaction type list of values
Personalization how to restrict transaction type list of values
 
Using Aura component with custom list button
Using Aura component with custom list buttonUsing Aura component with custom list button
Using Aura component with custom list button
 
Hr profile option
Hr profile optionHr profile option
Hr profile option
 
Secure Salesforce: Secret Storage in Your Salesforce Instance
Secure Salesforce: Secret Storage in Your Salesforce InstanceSecure Salesforce: Secret Storage in Your Salesforce Instance
Secure Salesforce: Secret Storage in Your Salesforce Instance
 
Apex code (Salesforce)
Apex code (Salesforce)Apex code (Salesforce)
Apex code (Salesforce)
 
Migration & upgrades best practice upgrade pathways to emc documentum 7
Migration & upgrades   best practice upgrade pathways to emc documentum 7Migration & upgrades   best practice upgrade pathways to emc documentum 7
Migration & upgrades best practice upgrade pathways to emc documentum 7
 
OOW15 - personalize and extend oracle ebs for desktops and tablets
OOW15 - personalize and extend oracle ebs for desktops and tabletsOOW15 - personalize and extend oracle ebs for desktops and tablets
OOW15 - personalize and extend oracle ebs for desktops and tablets
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Large Data Management Strategies
Large Data Management StrategiesLarge Data Management Strategies
Large Data Management Strategies
 

Ähnlich wie Leverage StandardSetController in Apex and Visualforce

MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts updatesupergigas
 
Winter24-Welly Release Overview - Stephen Stanley.pdf
Winter24-Welly Release Overview - Stephen Stanley.pdfWinter24-Welly Release Overview - Stephen Stanley.pdf
Winter24-Welly Release Overview - Stephen Stanley.pdfAnna Loughnan Colquhoun
 
Summer ‘14 Release Training by Astrea
Summer ‘14 Release Training by AstreaSummer ‘14 Release Training by Astrea
Summer ‘14 Release Training by Astreapriyanshi_astrea
 
Introduction to SailPoint Integration
Introduction to SailPoint IntegrationIntroduction to SailPoint Integration
Introduction to SailPoint Integrationsesametechnologies
 
Curso Symfony - Clase 3
Curso Symfony - Clase 3Curso Symfony - Clase 3
Curso Symfony - Clase 3Javier Eguiluz
 
WebClient Customization.pdf
WebClient Customization.pdfWebClient Customization.pdf
WebClient Customization.pdfsatyasekhar123
 
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and KellMartineMccracken314
 
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and KellAbbyWhyte974
 
ACADGILD:: ANDROID LESSON
ACADGILD:: ANDROID LESSON ACADGILD:: ANDROID LESSON
ACADGILD:: ANDROID LESSON Padma shree. T
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30fiyuer
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Oro Inc.
 
Murach : How to work with session state and cookies
Murach : How to work with session state and cookiesMurach : How to work with session state and cookies
Murach : How to work with session state and cookiesMahmoudOHassouna
 
Empowering users: modifying the admin experience
Empowering users: modifying the admin experienceEmpowering users: modifying the admin experience
Empowering users: modifying the admin experienceBeth Soderberg
 
Vpd Virtual Private Database By Saurabh
Vpd   Virtual Private Database By SaurabhVpd   Virtual Private Database By Saurabh
Vpd Virtual Private Database By Saurabhguestd83b546
 
CRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.doc
CRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.docCRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.doc
CRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.docKrisStone4
 
Optimization in django orm
Optimization in django ormOptimization in django orm
Optimization in django ormDenys Levchenko
 

Ähnlich wie Leverage StandardSetController in Apex and Visualforce (20)

MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
 
Winter24-Welly Release Overview - Stephen Stanley.pdf
Winter24-Welly Release Overview - Stephen Stanley.pdfWinter24-Welly Release Overview - Stephen Stanley.pdf
Winter24-Welly Release Overview - Stephen Stanley.pdf
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 
Summer ‘14 Release Training by Astrea
Summer ‘14 Release Training by AstreaSummer ‘14 Release Training by Astrea
Summer ‘14 Release Training by Astrea
 
Comilla University
Comilla University Comilla University
Comilla University
 
Introduction to SailPoint Integration
Introduction to SailPoint IntegrationIntroduction to SailPoint Integration
Introduction to SailPoint Integration
 
Curso Symfony - Clase 3
Curso Symfony - Clase 3Curso Symfony - Clase 3
Curso Symfony - Clase 3
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
WebClient Customization.pdf
WebClient Customization.pdfWebClient Customization.pdf
WebClient Customization.pdf
 
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
 
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
1. After reviewing chapters 9, 10, and 11 of the Kotler and Kell
 
ACADGILD:: ANDROID LESSON
ACADGILD:: ANDROID LESSON ACADGILD:: ANDROID LESSON
ACADGILD:: ANDROID LESSON
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
 
ClearPass Insight 6.3 User Guide
ClearPass Insight 6.3 User GuideClearPass Insight 6.3 User Guide
ClearPass Insight 6.3 User Guide
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
 
Murach : How to work with session state and cookies
Murach : How to work with session state and cookiesMurach : How to work with session state and cookies
Murach : How to work with session state and cookies
 
Empowering users: modifying the admin experience
Empowering users: modifying the admin experienceEmpowering users: modifying the admin experience
Empowering users: modifying the admin experience
 
Vpd Virtual Private Database By Saurabh
Vpd   Virtual Private Database By SaurabhVpd   Virtual Private Database By Saurabh
Vpd Virtual Private Database By Saurabh
 
CRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.doc
CRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.docCRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.doc
CRM Target Groups_C1B_CRM702_BB_ConfigGuide_EN_XX.doc
 
Optimization in django orm
Optimization in django ormOptimization in django orm
Optimization in django orm
 

Mehr von Salesforce Developers

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base ComponentsSalesforce Developers
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsSalesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaSalesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentSalesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsSalesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsSalesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsSalesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and TestingSalesforce Developers
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce dataSalesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionSalesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPSalesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceSalesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureSalesforce Developers
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DXSalesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectSalesforce Developers
 

Mehr von Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 

Leverage StandardSetController in Apex and Visualforce

  • 1. Leverage StandardSetController in Apex and Visualforce Developer Track 2012 Nebojsa (Nash) Zgonjanin, CRM Developer OnPath Ottawa, Ontario, Canada (www.onpath.com) Nebojsa.zgonjanin@onpath.com @Nzgon ca.linkedin.com/in/nashzgonjanin
  • 2. Abstract • Do you use list view filters? • Would you like to use that same logic in your Visualforce pages? • Don’t reinvent the wheel • Save time, and make your admin happier as well
  • 3. Nebojsa (Nash) Zgonjanin CRM Developer • Salesforce MVP (winter 2012), • Salesforce developer more than 6 years, • Senior developer (MS .NET) more than 15 years, • Work for www.OnPath.com, Ottawa, Ontario, Canada
  • 4. Session Objectives • StandardSetController and List View Filter Criteria (logic) • jQuery Table Sort and Visualforce page • Hierarchy Custom Setting used to control functionality per org (profile or user level) • Demo ”Add to Campaigns” of implemented technology
  • 5. Session Objectives • Short live demo of application to familiarize audience with topic • Use of Eclipse to browse code and point to key moments • Code in PPT presentation is used as reference
  • 6. Solution Intro I • StandardSetController and List View Filter Criteria • Define StandardSetController (SOQL query) • Apply Filter Criteria from List View to StandardSetController • Execute SOQL and use in Apex code
  • 7. Solution Intro II jQuery Table Sort and Visualforce Page • jQuery Setting • Static resources • <apex:includeScript> • Mash up of: • standard HTML table tags • <apex:repeat> tag • jQuery <script> code
  • 8. Solution Intro III Hierarchy Custom Settings (Levels of use) • Org default • Profile (group of users) • User (individual) • Use of setting values in Apex code • Use of setting values in Visual Force page • Demo: User (Serbian) vs. Org Default (English)
  • 9. Nash Code sample (package) available here: https://github.com/nzgonjanin/Dreamforce2012 Thank You
  • 10. Nebojsa (Nash) Zgonjanin, CRM Developer OnPath Ottawa, Ontario, Canada (www.onpath.com) Nebojsa.zgonjanin@onpath.com @Nzgon ca.linkedin.com/in/nashzgonjanin
  • 11. Solution intro I always wanted to leverage platform functionality and add more of client side functionality that browser bring in game. Combination of APEX controller extension and standard controllers (ApexPages.StandardController and ApexPages.StandardSetController) give me option to leverage standard platform functionality and add more flexibility and user interface functionality to Visual Force page using jQuery Table sorter (jquery.tablesorter.min.js) add on, that enable sorting of multiple columns. Using Custom setting I made available different set of parameters to be used per Org; Profile or User (labels, list views for filtering, Error Messages…) that enable easy internationalization if needed.
  • 12. Objectives and Solution I What is the Add to Campaigns app Salesforce.com provides features for adding many people to a single campaign, but what about an organization that manages multiple, ongoing campaigns like newsletters, customer programs, annual events, and even holiday card lists? Manually adding a single person to multiple campaigns one by one is a pain, and contributes to poor adoption, and incomplete or unusable data. This app application in salesforce.com allows users to add a single contact or lead to multiple campaigns with as few clicks as possible.
  • 13. Objectives and Solution II There are two portions to this application: end-user and administrator (non-developer). NOTE: Custom Settings, Standard List View filter, Standard Controller, StandardSetController are used to give end user (administrator) flexibility to manage data set used for app in combination with visual force page ADDTOCAMPAIGNS_LISTVIEWFILTER or using standard List View management under Campaigns tab. The end-user portion of the application works the same for both contacts and leads. Add a custom button to the Campaign History related list for both Leads and Contacts called "Add to Campaigns". When the end-user clicks this button display a list of campaigns with check boxes and a "check all" option. (The query for the list of campaigns will be determined in the administrator portion of the application.) When the end-user submits the form, insert the contact/lead to the campaign as member with the default status for that campaign and return the user back to the standard contact/lead details page.
  • 14. APEX controller extension (addtocampaigns_Extension.cls I ) public with sharing class addtocampaigns_Extension { //variables used on Visual force page for interaction with end user public Lead ParticipantLead {get; set;} //Lead record returned based on Id (pid) query parameter from custom button public Contact ParticipantContact {get; set;} //Contact record returned based on Id (pid) query parameter from custom button public string ParticipantId {get;set;} //Value of Query parameter pid public list<addtocampaigns_Wrapper> Campaign_List=new list<addtocampaigns_Wrapper>(); //List of campaign records to be used for selection public Boolean SubmitDisabled {get;set;} //[Submit] button and [Select All] button can be used just ones public AddtoCampaignsSetting__c mySetting {get; set;} //Custom Setting for logged user public addtocampaigns_Extension(ApexPages.StandardController controller) { //Standard controller extensin used to add custom functionality to visual force page ParticipantId=System.currentPageReference().getParameters().get('pid'); mySetting=AddtoCampaignsSetting__c.getInstance();//Custom Setting Definitions getParticipant(); //get Participant data from Lead or Contact getCampaign_List();//get list for campaign selection }
  • 15. APEX controller extension public ApexPages.StandardSetController con { (addtocampaigns_Extension.cls II) //Standard Set controller used to add custom functionality to visual force page //and leverage standard behavior of List View filters get { if(con == null) { //Standard set controller query used to retrieve data from Campaign object //used on visual force page to select potential campaigns integer myLimit=integer.valueOf(mySetting.RecordSet_Limit__c); if (myLimit==null){ myLimit=200; } con = new ApexPages.StandardSetController(Database.getQueryLocator( [Select Id, Name, StartDate,EndDate, Type, Status, ParentId, RecordTypeId FROM Campaign order By Name,StartDate limit :myLimit])); //in order to use it again you need to refresh page or go back to participant and start again //set filter id that is applied for Hierarchy setting Org/Profile/User if (mySetting.ListViewId__c!=null){ //Filter Magic is heppening here con.setPageSize(myLimit); con.setFilterID(mySetting.ListViewId__c); } } return con; } set; }
  • 16. APEX controller extension //Queried data set is used to laverage data set (addtocampaigns_Extension.cls III) public List<addtocampaigns_Wrapper> getCampaign_List() { //get list for campaign selection if (Campaign_List.Size()==0){ //Load campign list just ones on first page load //(List<Campaign>)con.getRecords()) will execute query and //apply defined mySetting.ListViewId__c as filter to set of records for (Campaign camp: (List<Campaign>)con.getRecords()){ Campaign_List.add(new addtocampaigns_Wrapper(camp)); //check if participant is already part of campaign and disable it for selection if (ParticipantId.startsWith('00Q')){ //process lead campaign member records for (CampaignMember CM :ParticipantLead.CampaignMembers){ if (CM.CampaignId==camp.Id && Campaign_List.Size()>0){ //disable check box on visual force page Campaign_List[Campaign_List.size()-1].disabled=true; break; } } }else{ //process contact campaign member records for (CampaignMember CM :ParticipantContact.CampaignMembers){ if (CM.CampaignId==camp.Id && Campaign_List.Size()>0){ //disable check box on visual force page Campaign_List[Campaign_List.size()-1].disabled=true; break; } } } } } return Campaign_List; }
  • 17. Addtocampaigns_Wrapper.cls (used in APEX controller extension to support app functionality) public with sharing class addtocampaigns_Wrapper { //variables used for creating add to Campaigns record public String message{ get; set; } //success message public Boolean checked{ get; set; } //check box for selection public Boolean disabled {get; set;} //if member is alread part of campaign selection check box is disabled public Campaign camp { get; set;} //Campaign record returned as part of data set driven by listView filter public addtocampaigns_Wrapper(){ //constructor without passed parameters camp = new Campaign(); checked = false; disabled = false; message=''; } public addtocampaigns_Wrapper(Campaign c){ //constructor with passed parameters camp = c; checked = false; disabled = false; message=''; } }//end of class
  • 18. Visual Force Page code overview (addtocampaigns_ListViewFilter.page) <apex:page standardController="Campaign" tabStyle="Campaign" standardStylesheets="true"> <apex:sectionHeader title="Cloudspokes" subtitle="{!$Setup.AddtoCampaignsSetting__c.Header_Subtitle__c}"/> <apex:enhancedList height="300" rowsPerPage="100" listId="{!$Setup.AddtoCampaignsSetting__c.ListViewId__c}" id="CampaignsList" customizable="True" /> </apex:page>
  • 19. Visual Force Page code overview (addtocampaigns.page I) <apex:page standardController="Campaign" extensions="addtocampaigns_Extension" tabStyle="Campaign" standardStylesheets="true"> <!-- jQuery plug in for table sort my multiple columns --> <apex:includeScript value="{!URLFOR($Resource.jQuery_TableSort, 'jquery-latest.js')}" /> <apex:includeScript value="{!URLFOR($Resource.jQuery_TableSort, 'jquery.tablesorter.min.js')}" /> <apex:stylesheet value="{!URLFOR($Resource.jQuery_TableSort , '/themes/blue/style.css')}" /> <script> $j = jQuery.noConflict(); $j(document).ready(function() { $j("#myTable").tablesorter( {sortList: [[1,0], [2,1]]} ); } ); </script> <apex:sectionHeader title="Cloudspokes" subtitle="{!$Setup.AddtoCampaignsSetting__c.Header_Subtitle__c}"/> <apex:form > <apex:pageBlock id="CampaignMember" mode="detail"> <apex:pageBlockButtons > <apex:commandButton id="Back" action="{!GoToParticipant}“ value="{!$Setup.AddtoCampaignsSetting__c.button_Back_Label__c}" /> <apex:commandButton id="SelectAll" action="{!SelectAll}" value="{!$Setup.AddtoCampaignsSetting__c.button_SelectAll_Label__c}" disabled="{!SubmitDisabled}"/> <apex:commandButton id="Submit" action="{!Submit}" value="{!$Setup.AddtoCampaignsSetting__c.button_Submit_Label__c}" styleClass="btnImportant" disabled="{!SubmitDisabled}"/> <apex:commandLink id="FilterSetting" action="{!FilterSetting}" target="_blank" value="Filter Settings" />
  • 20. Visual Force Page code overview (addtocampaigns.page II) //Lead Section <apex:pageBlockSection title="{!$Setup.AddtoCampaignsSetting__c.pageBlockSection_Lead__c}" columns="2" showHeader="true" collapsible="false" rendered="{!if(ParticipantLead.Id==null,false,true)}"> <apex:outputField id="LeadFirstName" value="{!ParticipantLead.FirstName}" /> <apex:outputField id="LeadCompany" value="{!ParticipantLead.Company}" /> <apex:outputField id="LeadLastName" value="{!ParticipantLead.LastName}" /> <apex:outputField id="LeadEmail" value="{!ParticipantLead.Email}" /> </apex:pageBlockSection> //Contact section <apex:pageBlockSection title="{!$Setup.AddtoCampaignsSetting__c.pageBlockSection_Contact__c}" columns="2" showHeader="true" collapsible="false“ rendered="{!if(ParticipantContact.Id==null,false,true)}"> <apex:outputField id="ContactFirstName" value="{!ParticipantContact.FirstName}" /> <apex:outputField id="ContactCompany" value="{!ParticipantContact.Account.Name}" /> <apex:outputField id="ContactLastName" value="{!ParticipantContact.LastName}" /> <apex:outputField id="ContactEmail" value="{!ParticipantContact.Email}" /> </apex:pageBlockSection> //Select campaigns section that mix jQuery (client side) and APEX server side functionality <apex:pageBlockSection title="{!$Setup.AddtoCampaignsSetting__c.pageBlockSection_Campaigns__c}" columns="1" showHeader="true" > {!$Setup.AddtoCampaignsSetting__c.Note__c} </apex:pageBlockSection>
  • 21. Visual Force Page code overview (addtocampaigns.page III) //standard HTML table tags used with apex:repeat tag to obtain data set <table id="myTable" class="tablesorter"> <thead> //table headers <tr> <th>{!$Setup.AddtoCampaignsSetting__c.column_Select_Header__c}</th> <th>{!$Setup.AddtoCampaignsSetting__c.column_Name_Header__c}</th> <th>{!$Setup.AddtoCampaignsSetting__c.column_StartDate_Header__c}</th> <th>{!$Setup.AddtoCampaignsSetting__c.column_EndDate_Header__c}</th> <th>{!$Setup.AddtoCampaignsSetting__c.column_Type_Header__c}</th> <th>{!$Setup.AddtoCampaignsSetting__c.column_Status_Header__c}</th> <th>Parent</th> <th>Record Type</th> </tr> </thead> <tbody> //table rows (data set from list view) <apex:repeat value="{!Campaign_List}" var="Camp" id="theRepeat"> <tr> <td> <apex:inputCheckbox id="Selected" value="{!Camp.checked}" disabled="{!Camp.disabled}"/></td> <td> <apex:outputField id="Name" value="{!Camp.Camp.Name}"/></td> <td> <apex:outputField id="StartDate" value="{!Camp.Camp.StartDate}"/></td> <td> <apex:outputField id="EndDate" value="{!Camp.Camp.EndDate}"/></td> <td> <apex:outputField id="Type" value="{!Camp.Camp.Type}"/></td> <td><apex:outputField id="Status" value="{!Camp.Camp.Status}"/></td> <td><apex:outputField id="Parent" value="{!Camp.Camp.ParentId}"/></td> <td><apex:outputField id="RecordType" value="{!Camp.Camp.RecordTypeId}"/></td> </tr>
  • 22. Custom Setting Hierarchy type overview Hierarchy Custom Settings: A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings. https://na14.salesforce.com/help/doc/user_ed.jsp?loc=help&target=cs_manage_data.htm&section=integrate