Saturday 22 November 2014

Types of Sandbox


1. Developer Sandbox : Developer sandbox are intended for coding and testing. Developer sandbox copies all application and configuration set up information to sandbox.

2. Pro - Developer Sandbox : Pro Developer are intended for coding and testing. Copies all your production org reports and dashboards, price book, products, apps and customization but excludes all organisation standard and custom records, documents and attachments. Pro developer have large storage limit which allow more robust development and more test data sets

3. Partial Data Sandbox : Partial copy sandbox are intended to be used as testing environment and can be used for quality assurance tasks such as user acceptance testing and training. It includes reports and dashboards, pricebook, products, app, customization and custom and standard records, documents and attachments.

4. Full Sandbox : Exact copy of Production including all data, supports full performance testing, load testing.


Comparison :

Sandbox Name          Copies Metadata        Copies Data        Refresh Limit        Data Limit

Developer                    Yes                     No                Daily              200MB

Pro Developer             Yes                     No                Daily               1 GB

Partial                          Yes                     Yes               5 Days             5 GB

Full                               Yes                     Yes               29 Days      Same as Prod

Page Layout and Record Types 


Page Layout:
Page Layout is a organisation of fields, custom links, and related lists on Object detail page, From page layout we can see which fields links and related list a user will see and also decide which field should be read only and required. Page layout also provides us to create new page sections.




Record Types:
Record Type allow us to associate different business processes and subset of pick-list value to different users based on their user profile. Record type can be used to decide what page layout user will see while viewing the records based on their user profile. We can tailors our user interaction according to business specific needs.

Salesforce Activities : Difference between Task and Event

Activities in Salesforce are of two types Task and Event.

Task are basically used to log an activity like call, reminders, emails while Events are used scheduling meetings etc.

1. Tasks : A task is an activity not schedule for any date and time. You can specify a due date for a task or there may not be any particular date or time that task need to be completed
examples: 
 - making a phone call
 - opening a email

think of task like a check box whose value can only either be true or false.

2. Event : An event is an calendar event scheduled for a specific day and time
examples :
 - meeting, 
 - conference call

event carry a aspect of duration of time


Salesforce Relationships


In salesforce you can  associates objects with other objects using relationship.
You can define different types of relationships by define custom relationship fields and different relationship also determine the approach of data deletion, record ownership, security.

Types of Relationship:

1. Master - Detail (1:n) : Its a parent child relationship in which Master object controls the behavior of child object like
a) When master record is deleted its related detail/child record also gets deleted.
b) Owner field on detail/child object is not available and its owner is automatically set to owner of its Master object record.

c) Custom object of detail side of Master Detail relationship do not have sharing rule, manual sharing as these require Owner field.

d) Detail record inherit the sharing and security settings from its master record.
e) Master - Detail relationship field is required on page layout of the detail record.

f) By default detail records can not be re-parented, however administrator allow re-parenting by enabling "Allow re-parenting " option in the master detail relationship.

Note : You can define Master - Detail relationship between custom objects or between custom object and standard object but standard object can not be on the detail side.
Note : You can also not create master detail relationship where User or Lead objects are masters.

 * You can not create Master Detail relationship if custom object already contains data. To create Master Detail relationship first you need to create a look-up field and then converting them to Master detail if look-up field in all records contains a value.
* You can not delete a object if it is on Master Side of Master - Detail relationship and if you delete a object that is on detail side of Master - Detail relationship then relation is converted into look-up.
* Deleting Master record also delete related record.
* Undeleting Master record also undelete detail record.
Deleting detail record moves it to recycle bin.
* Undeleting detail record restores it.
* If you delete detail record and then separately delete Master record then you can not undelete related record because there is no Master record.


2. Many to Many : You can use Master Details relationship to create Many to Many relationship between two objects. This relationship allow each object to link with multiple record of other objects and vice-versa. Many to Many relationship requires a custom junction object with two master detail fields on page layout.



* Sharing access to junction object record is determine by the sharing access to both associated master objects records and Sharing setting option on relationship field. For example, if the sharing setting on both parents is Read/Write, then the user must have Read/Write access to both parents in order to have Read/Write access to the junction object. If, on the other hand, the sharing setting on both masters is Read-Only, a user with Read-Only rights on the master records would have Read/Write access to the junction object.

* user can not delete master object record if there are more that 200 detail object records.

* first master detail relationship you create becomes the primary relationship for junction object which affects
a) Look and Feel 
b) Record ownership

* second master detail relationship on junction object becomes the secondary relationship and if primary master-detail relationship is deleted then secondary becomes primary relationship.
* junction object can not be on Master side of another master-detail relationship.
* Many to Many provides two standard reports
1) "Primary master with junction object and Secondary master "
2) "Secondary master with junction object and Primary master"



3. Look-up Relationship :  This kind of relationship links two object. Unlike master-detail relationship look-up fields are not automatically required and data from one object appears as related list on page layout of other object.

* while creating look-up relationship we can select the option to make the field required.
* if look-up field is optional and look up record is deleted, we can select one of the below behaviors
a) "Clear the value of this field " ( this is default ) 
b) "Don't allow deletion of the look-up record that's a part of a look-up relationship"

* You can not delete an object or record in a look-up relationship if the combined number of records between two linked objects is more than 100,000.

Saturday 15 November 2014

Custom Component


Custom Components allows the custom visualforce functionality to be encapsulated as discrete modules, which actually provides two advantage:

1. Code re-use : custom component provides an functionality of code reuse, we can use the same code for number of pages.

2. Functional decomposition : if visualforce page is lengthy then we can broke down the page into custom components to make it easier to develop and easy to maintain.

like visualforce page custom component can also have controller but only custom component.

* Custom component do not have any associated security settings. A user with access to visualforce page have access to all custom component used in visualforce page.


example :

go to setup > develop >  custom componet  to create custom component and paste the below code.

<apex:component >
  <apex:attribute name="Contact" type="Contact" description="The contact to edit" required="true" />
  <apex:pageBlockSection columns="3" title="Name">
    <apex:inputField value="{!Contact.Salutation}"/>
    <apex:inputField value="{!Contact.FirstName}"/>
    <apex:inputField value="{!Contact.LastName}"/>
  </apex:pageBlockSection>
</apex:component>


go to :
to know about apex:attribute.


create visualforce page and paste below code

<apex:page standardController="Contact">
    <apex:sectionHeader title="Contact Edit" subtitle="{!contact.name}"/>
    <apex:form >
        <apex:pageBlock mode="maindetail">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}"/>
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            </apex:pageBlockButtons>
            <c:ContactNameEdit contact="{!contact}"></c:ContactNameEdit>
            <apex:pageblockSection title="{!Contact}">
                <apex:inputField value="{!contact.phone}"/>
                <apex:inputField value="{!contact.doNotCall}"/>
                <apex:inputField value="{!contact.Fax}"/>
                <apex:inputField value="{!contact.hasOptedOutOfFax}"/>
                <apex:inputField value="{!contact.email}"/>
                <apex:inputField value="{!contact.hasOPtedOutOfEmail}"/>
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Monday 10 November 2014

Change Images When Picklist value Changes



You can add create a functionality in which on change on picklist value the images will change. To do so add images in your static resource and create vf page and controller with below code. 


Visualforce page:

<apex:page controller="PicWithPicklist">
    <apex:form >
        <apex:pageBlock >
            <apex:selectList value="{!legend}" size="1">
                <apex:selectOptions value="{!legendNames}"></apex:selectOptions>
                 <apex:actionSupport event="onchange" reRender="picPanel"/>
            </apex:selectList>
        </apex:pageBlock>
    </apex:form>   
   
    <apex:outputPanel id="picPanel">
   <apex:image rendered="{!legend='jobs'}" value="{!$Resource.jobs}" width="200" height="200"/>
        <apex:image rendered="{!legend='gates'}" value="{!$Resource.gates}" width="200" height="200"/>
        <apex:image rendered="{!legend='benioff'}" value="{!$Resource.mark}" width="200" height="200"/>
        <apex:image rendered="{!legend='larry'}" value="{!$Resource.larry}" width="200" height="200"/>
    </apex:outputPanel>
</apex:page>

Controller :

public class PicWithPicklist {

    public String legend;
   
    public void setLegend(string legend) {
        this.legend = legend;
    }
   
    public String getLegend() {
        return legend;
    }
   
    public List<SelectOption> getLegendNames() {
        List<SelectOption> option = new List<SelectOption>();
        option.add(new SelectOption('None', 'none'));
        option.add(new SelectOption('jobs', 'Steve Jobs'));
        option.add(new SelectOption('gates', 'Bill Gates'));
        option.add(new SelectOption('benioff', 'Mark Benioff'));               
        option.add(new SelectOption('larry', 'Larry Ellison'));       
        return option;
    }
   
}  

Wednesday 5 November 2014

Winter 15 Release  - Advanced Setup Search


Winter 15 makes the search more powerful allowing to search for individual setup items which in earlier version only returned the titles of pages in setup menu. 

In earlier version when we tried to search workflow the result returned is like below picture.


but from winter 15 when tried to search workflow result returned would be



  
This feature is enabled for all organization by default. You can disable this feature from setup -> user interface