Monday, July 14, 2014

Removing The ViewState Coming in URL.

Hi  EveryOne,

   Basically when we click on Button we will perform some action in controller and we will redirect to same using ApexPages.CurrentPage().Whenever we use that functionality some case we will get viewState in the URL.So workaround it to remove the ViewState and to form actual URL agian we need to de below thing.

Input:
ViewState URL:
 https://c.cs9.visual.force.com/apex/PageName?com.salesforce.visualforce.ViewStateCSRF=DDJ0GM8ZVlS85i.RSAD.zXbq2770v0bY5Ypf3JQQI.j3VWgsnKQUR30SUBWmc3pyk8iF.xW2Ev49fvI7IY72CVu8bUX0Th6mxUcy3UJXlPdcOisfzgca39Va2H2t2AhgEbBwLEx6.g8voCONr_8IZRIQsqQ%3D&com.salesforce.visualforce.ViewStateVersion=201312112156340748&delMetricId=a2LK0000000QxpVMAS&id=a1DK000000wpLTsMAM&thePage%3AtheBlock%3Aj_id402%3Aj_id403=thePage%3AtheBlock%3Aj_id402%3Aj_id403&thePage%3AtheBlock%3Aj_id402%3Aj_id403%3Aj_id407%3A0%3Aj_id430=thePage%3AtheBlock%3Aj_id402%3Aj_id403%3Aj_id407%3A0%3Aj_id430

 
    public PageReference yourmethodname(){
       //Your Logic
       pageReference pref = ApexPages.currentPage(); 
       Id id = pref.getParameters().get('Id');
       pref .getParameters().clear();
       pref .getParameters().put('Id', id);  
       pref .setRedirect(true);
       return pref;  
}

OutPut : https://c.cs9.visual.force.com/apex/PageName?id='recordId'

Saturday, June 28, 2014

Customer Care service: How To print Current page in sales force

Customer Care service: How To print Current page in sales force: Here how to print  current page in salesforce  salesforce can provide so many nationalities but some time our Customers Asking so critical r...

Friday, June 27, 2014

How to HIde and Show Password Value in Visual Force page using JQuery

  <html xmlns="http://www.w3.org/1999/xhtml">  
 <head id="Head1" runat="server">  
   <title></title>  
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">  
   </script>  
   <script type="text/javascript">  
     $(document).ready(function () {  
       $('#txtPwd').blur(function () {  
         $('#txthdnPwd').val($(this).val());  
       });  
       $('#chkHidShw').change(function () {  
         var isChecked = $(this).prop('checked');  
         if (isChecked) {  
           $('#txtPwd').hide();  
           $('#txthdnPwd').show();  
           $('#txthdnPwd').attr('readonly', 'readonly');  
         }  
         else {  
           $('#txtPwd').show();  
           $('#txthdnPwd').hide();  
         }  
       });  
     });  
   </script>  
 </head>  
 <body>  
   <form id="form1" runat="server">  
   <div>  
     UserName:  
     <input type="text" id="txtUser" runat="server" />  
     <br />  
     Password:&nbsp;  
     <input type="password" id="txtPwd" runat="server" />  
     <input type="text" id="txthdnPwd" style='display: none;' />  
     <br />  
     <input type="checkbox" id="chkHidShw" />&nbsp;Show Password  
   </div>  
   </form>  
 </body>  
 </html>  

Monday, June 16, 2014

Trigger Frameworks and Apex Trigger Best Practices

            I’ve read a lot of Apex Trigger code in my career. While I was consulting, I was able to see the good, the bad, and the ugly when it came to Trigger implementations. For the triggers that took a wrong turn at some point, the story was almost always the same. 
            The initial trigger was small, and served a single purpose. Over time, as new business requirements emerged, that once tiny trigger started growing and growing into a monstrosity. New functionality was routinely tacked on and technical debt began to accumulate. Now the logic was hard, if not impossible to follow. It was also becoming increasingly difficult to maintain because even the slightest change might mean rewriting the whole trigger from scratch. The tests were unreliable. Trigger logic was executing out of order and governor limits were getting hit left and right. I took a good look at not only the bad triggers that I saw, but the good ones as well. I started coming up with some best-practices that would help developers avoid some of these pitfalls. So before we get into Trigger Frameworks, which is the subject of this article, let’s first talk about some of the best practices developers should be aware of when it comes to trigger writing.Click Here For More