Skip to main content

Posts

Showing posts from November, 2015

How to make java script function will execute after the controller method executed?

As we all know java script function will execute first then controller method executes, In some case we need java script method should execute first. Below is the work around for this case. Instead of normal java script we will use on load java script which means when page loads/refresh that java script function will execute. Again it will be problem because each and every time that method will execute. How to avoid this ? We will use a Boolean variable to control execution. public Boolean isJavascriptInvoked {         get {             if (null == this.isJavascriptInvoked ) {                 this.isJavascriptInvoked = false;                         }             return this.isJavascriptInvoked ;         }         set;     } public PageReferen...

How to get document URL dynamically ?

A we all know sales-force host name (na5,or cs20) used to change from sandbox to production and also when SFDC refresh their server. That is why it is always suggested not to use any hard coded link. Below is code snippet to get document URL dynamically.  //method to send document link       public Static String getDocumentRelativeLink(String documentName){         String documentURL= '';         try{             list<Document> doc = [Select id,Name,SystemModStamp From Document Where Name  = :documentName];             ID docIds = doc[0].id;             documentURL ...