Ads

Saturday, 25 May 2013

Events in jQuery?

$(document).ready()
The $(document).ready() method allows us to execute a function when the document is fully loaded.

click()
The function is executed when the user clicks on the HTML element.

dblclick()
The function is executed when the user double-clicks on the HTML element:

mouseenter()
The function is executed when the mouse pointer enters the HTML element:


mouseleave()
The mouseleave() method attaches an event handler function to an HTML element.
The function is executed when the mouse pointer leaves the HTML element:
  
mousedown()
The function is executed, when the left mouse button is pressed down, while the mouse is over the HTML element:
  
mouseup()
The function is executed, when the left mouse button is released, while the mouse is over the HTML element:


hover()
The first function is executed when the mouse enters the HTML element, and the second function is executed when the mouse leaves the HTML element.


focus()
The function is executed when the form field gets focus.


blur()
The function is executed when the form field loses focus.

jQuery Fading Methods?

jQuery has the following fade methods:

  • fadeIn()
  • fadeOut()
  • fadeToggle()
  • fadeTo()

jQuery fadeIn()

The jQuery fadeIn() method is used to fade in a hidden element.

Syntax:


$(selector).fadeIn(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is the name of a function to be executed after the fading completes.
The following example demonstrates the fadeIn() method with different parameters:


jQuery fadeOut()

The jQuery fadeOut() method is used to fade out a visible element.

Syntax:


$(selector).fadeOut(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is the name of a function to be executed after the fading completes.
The following example demonstrates the fadeOut() method with different parameters:


jQuery fadeToggle()

The jQuery fadeToggle() method toggles between the fadeIn() and fadeOut() methods.
If the elements are faded out, fadeToggle() will fade them in.
If the elements are faded in, fadeToggle() will fade them out. 

Syntax:


$(selector).fadeToggle(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is the name of a function to be executed after the fading completes.
The following example demonstrates the fadeToggle() method with different parameters:


jQuery fadeTo()

The jQuery fadeTo() method allows fading to a given opacity (value between 0 and 1).

Syntax:


$(selector).fadeTo(speed,opacity,callback);
The required speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The required opacity parameter in the fadeTo() method specifies fading to a given opacity (value between 0 and 1).
The optional callback parameter is the name of a function to be executed after the function completes.

jQuery Sliding Methods

jQuery Sliding Methods

With jQuery you can create a sliding effect on elements.
jQuery has the following slide methods:

  • slideDown()
  • slideUp()
  • slideToggle()

jQuery slideDown() Method

The jQuery slideDown() method is used to slide down an element.

Syntax:


$(selector).slideDown(speed,callback);
 
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is the name of a function to be executed after the sliding completes.
The following example demonstrates the slideDown() method:

Example

$("#flip").click(function(){
  $("#panel").slideDown();
});

jQuery slideUp() Method

The jQuery slideUp() method is used to slide up an element.

Syntax:


$(selector).slideUp(speed,callback);
 
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is the name of a function to be executed after the sliding completes.
The following example demonstrates the slideUp() method:

Example

$("#flip").click(function(){
  $("#panel").slideUp();
});


jQuery slideToggle() Method

The jQuery slideToggle() method toggles between the slideDown() and slideUp() methods.
If the elements are slide down, slideToggle() will slide them up.
If the elements are slide up, slideToggle() will slide them down. 


$(selector).slideToggle(speed,callback);
 
The optional speed parameter can take the following values: "slow", "fast", milliseconds.
The optional callback parameter is the name of a function to be executed after the sliding completes.

The following example demonstrates the slideToggle() method:

Example

$("#flip").click(function(){
  $("#panel").slideToggle();
});

Thursday, 23 May 2013

Inserting Attachments using Apex Dataloader in Salesforce?


Inserting Attachments using Apex Dataloader in Salesforce

Once I came to know we can able to extract the Notes and attachments from an object using Dataloader, I thought importing the attachment is also the same and we can do it very easily in the same manner but I was wrong.


Let us see how we can do this using dataloader,but before that please recall 
How to Import/Export Notes and Attachment through DataLoader in Salesforce

For importing or inserting an attachment to an object (say Account) we need the following details in the CSV file that we are going to use in the Data loader.

PARENTID
NAME
CONTENTTYPE
BODY
OWNERID


PARENTID:
This is nothing but the Salesforce ID of the Parent object record(Say AccountID).


NAME: 
Name is the name of the attachment file.


CONTENTTYPE:

The File Format eg: Doc,txt,xls,pdf..

BODY:
This one plays an important role while importing an attachment.
We must give the Path of the attachment in the local Machine.
Make sure the File must follow with its extensions i.e .pdf,.doc.xls, etc

Example: C:\Program Files\salesforce.com\Data Loader\Test1\Attachments\TestDoc.doc



OWNERID:

Thursday, 16 May 2013

Dynamic Dashboard in Salesforce?


  1. Dashboard which is running under current logged in user permission are known as “dynamic Dasboard”. 
  2. At the most 3 dynamic dashboards can be built
  3. Available in Unlimited, Enterprise and developer edition. 
  4. Dynamic dashboard cannot be scheduled for refresh. It must be scheduled manually.

How to create One to One relationship in Salesforce?

In Salesforce, we have One to Many relationship and Many to Many relationship.

To achieve One to One relationship in Salesforce, kindly follow the below steps

Objects: Interest, Employee.
Relationship: Interest is Master and Employee is Detail. 

1. Create a Roll up Summary field on Interest object to find the number of employees(Count).


2. Create a trigger in Employee object to check whether Number Of Employees is equal to one. If it is one, then throw an error, else allow the user to create.

Trigger:

trigger oneToOne on Employee__c (before insert, before update)
{
    for(Employee__c e : trigger.New)
    {
        String empId = e.Interest__c;
        Interest__c i = [SELECT Number_of_employees__c FROM Interest__c WHERE Id =: empId];
        Decimal empStrength = i.Number_Of_Employees__c;
        if(empStrength == 1)
        {
            e.addError('Already an employee has been associated with this interest');
        }
    }
}


Output:

Record types in Salesforce?

Record types allow you to offer different business processes, picklist values, and page layouts to different users based on their profiles. Record types can be used in various ways, for example:
  • Create record types for opportunities to differentiate your regular sales deals from your professional services engagements and offer different picklist values for each.
  • Create record types for cases to display different page layouts for your customer support cases versus your billing cases.