Skip to main content

Posts

Showing posts from 2015

How to Delete Triggers from Production Org

We can delete unnecessary triggers in Production by using the eclipse IDE: Step 1:  Assuming you have a sandbox environment synchronized with your Prod org, you will first want to inactivate the trigger in sandbox. You can refresh your IDE project to consume these changes Step 2:   In the Sandbox org, you will then want to run all tests: Navigate to Setup-->Develop-->Apex Classes and click "Run All Tests". This will run all of the tests in the sandbox org. This is an important step to validate whether or not the inactive trigger has impacted any asserts within your test methods. Assuming this behavioral change has impacted your tests, you will need to update your asserts to reflect this. Step 3:  Once all tests are passing, you can now deploy these changes to your production environment. You can use the Deploy to Server wizard in the IDE. Simply select the tests that you have modified, as well as the inactive trigger, and deploy these chan...

Track Field History for more than 20 fields - Salesforce

All of us would have come across a situation when we need to track more than 20 fields for an object in salesforce. We have raised this Idea around 8 years ago in the success community. But sill it has't implemented by salesforce. But for now, we can achieve it partially with the following workaround. Approach: This approach uses a custom Text field which stores values of multiple other individual fields. Then enabling field history tracking of this field would allow you to track changes for multiple sets of other individual fields. Thus even though remaining within the count limit 20, yet track changes of more than 20 fields. Let us in this example take “Account ”  object and apply the steps to track change in Account Name, Phone, Parent Account and Billing Address all together. Steps: Step 1:  Add a new custom field. Setup -> Customize -> Accounts -> Fields Create a new Text (255) field “ Track FieldHistory ” (Or give any other n...

Search records in salesforce using SOSL query

How to build a custom search page to fetch records dynamically. Here I have built custom search on a custom object called KnowledgeArticle__c Controller: public with sharing class KBASearchController{      private Integer OffsetSize = 0;      private Integer QueryLimit = 200;      private Integer CountTotalRecords{get;set;}      public string globalSearch{get;set;}      private id  Articlename{set;get;}      private static List<KnowledgeArticle__c> outputRecords;      public PageReference ViewData() {         return runSearch();     }     public pagereference doGlobalsearch(){               if(globalSearch==null || globalSearch==''){             ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.ERROR,'Please enter global search criteria t...