Thursday, October 16, 2014

How to use Streaming API in visualforce Salesforce

Ok so as per new enhacnement Slaesforce has introduced streaming API in force.com. The cool thing is that it works on "Comet" model, its accually a long-held HTTP request model. So if a connection is open it will get the new updates through polling. The server will pust the new data into the stream and thus we will get notification in page without even using page reload or API request.


Result:

Hope this helps you!!

Tuesday, October 7, 2014

How to get all property of a javascript [object object]

Ok so sometime when usings others code in javascript me might not be knowning the property that returning object has. So to get the property just use this code after initilizing and record all the available property and values and then use accourdingly.

Option 1:
for(var key in conn) {

    var value = key +" : "+ conn[key]; console.log("***"+value); 
} 
Option 2:
console.log(conn);  

Hope this helps you!!

Sunday, October 5, 2014

How to use workflow outbound message to send xml to other systems

Ok so I was not finding any good articals to learn how to use outbound message in Salesforce.

So to begin just create a workflow at your desired object.
Now create a action of type "Outbound Message" and give the field information.
Now in the "Endpoint URL" give the URL you want to post data to eg: http://example.in/wscd.asmx etc.
Now give the fields in the multy select box to be sent with request.

And this the output you will receive on the end point.













Salesforce automatic gives it a XML formate and the reciver endpoint service must parse this to get the posted data.

Hope this helps you!!

Thursday, October 2, 2014

How to understand and use Interface, Abstract and Virtual definition modifier in apex Salesforce

Ok so this is a very conceptual module in apex or OOPs programming.

Interface is a which none of the methods have been implemented but when its implemented then it is mandatory to define all of its declared method in the implementing class. Also we cannot define any fields in interface and all the method are final and pubic.

Example:

public interface custom_Interface{
    void CallFirst();
    Void CallSecond();
}
public class Implement_custom_Interface implements custom_Interface{
    public void CallFirst(){
        //
        system.debug('***First**');
    }
    public void CallSecond(){
        //
        system.debug('***Second**');
    }
}

Abstract class is class with only declaration and no definition but its mandatory to override all the method.

Example:

public abstract class custom_Abstract{
    public abstract string AbstractFirst();
    public abstract string AbstractSecond();
    public void noReturn(){
    }
}
public class Implement_custom_Abstract extends custom_Abstract{
    public override string AbstractFirst(){
        system.debug('***From Abstract Extends Class***');
        return null;
    }
    public override string AbstractSecond(){
        system.debug('***From Abstract Extends Class***');
        return null;
    }
}

Virtual class is having definition of the method and if you need you can override the method, but its not mandatory to implement all the methods.

Example:


public virtual class coustom_Virtual{
    public virtual void OverFirst(){
        system.debug('****From  Defination****');
    }
    public virtual void OverSecond(){
        system.debug('****From  Defination****');
    }
}
public class Implement_coustom_Virtual extends coustom_Virtual{
    public override void OverFirst(){
        system.debug('!!!From  Declairation!!!');
    }
}
Hope this helps you!!