How to deploy any trigger from sandbox to production?

In order to deploy a trigger from sandbox to production, you need to take care of some points:

  • At first I would like to request you all that before going for any deployment, make sure that there is no test failure or less than 75% code coverage in Production Instance. Because when we deploy any thing from sandbox to Production, “Run All Test” is performed automatically in Production. If there is any issue in Production then it will not let you deploy your new code.
  • If you are deploying any trigger in Production, then you must write a test class for that trigger with no Test failure and more than 75% code coverage.
  • Create deployment connection in sandbox.
  • Create Outbound change set in Sandbox and add your trigger and its associated test class in the change set.
  • Create Inbound change set in Production.
  • Add Change set components in Sandbox.
  • Upload the change set.
  • You can validate the change set in Production.
  • Finally deploy the change set in Production.

Hope this will help to deploy a trigger from sandbox to production.

Close popup and refresh parent window in Visualforce Page

Its a very common requirement to open a pop up by clicking a button . Once you are done with pop up, close the pop up and refresh the parent window so that user will be able to see the update on parent window at the same time.

Here is the sample code for it:

Command button in Visualforce Page:

<apex:commandbutton action="{!save}" id="button" oncomplete="javascript:CloseAndRefresh()" value="Update"/>

And here is the java script function:

<script language="JavaScript" type="text/javascript">
function CloseAndRefresh(){
window.opener.location.href="/{!$CurrentPage.parameters.id}";
window.top.close();

}
</script>

Note: I would suggest to check this setting Setup-> Personal Setup  ->  My Personal Information -> Personal Information
Here check for “Development Mode”. I have seen at various places and at community as well that if this check box is checked then popup would not close. Here, I would suggest to turn this checkbox off while you are testing this.

Static Constructor

A static constructor is used to initialize any static data, or to perform a particular action that needs performed once only. It is called automatically before the first instance is created or any static members are referenced.

Static constructors have the following properties:

  • A static constructor does not take access modifiers or have parameters.
  • A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
  • A static constructor cannot be called directly.
  • The user has no control on when the static constructor is executed in the program.
  • A typical use of static constructors is when the class is using a log file and the constructor is used to write entries to this file.
  • Static constructors are also useful when creating wrapper classes for unmanaged code, when the constructor can call the Load Library method.
  • You can’t overload it.

What is Salesforce?

download

Today the world is leaded by Cloud computing. Salesforce.com is one of the way for moving all your applications to cloud. There are lots of question running in your mind that what is Salesforce? What are its features? What are the benefits of moving apps to Salesforce? So to answer your questions, here is a small article which would help you find your answers. I have tried here to answer all these questions in a simple manner.

Salesforce is a SaaS (software-as-a-service), global enterprise software company Best known for its Customer Relationship Management (CRM), that is now also offering platform-as-a-service. Salesforce is a pioneer  in providing a high quality on-demand CRM software (referred to as “The Sales cloud” by Salesforce). They have diversified into customer service and support on-demand offerings as well (referred to as “The service cloud” by Salesforce).

Salesforce is a classic manifestation of two (SaaS and PaaS) out of the three major components of cloud computing.

Following is a list of products and services offered by Salesforce :

  • Customer Relationship Management (CRM) –  Their CRM is best in class in the on-demand category. With highly robust features and ease to customize, its one of the most adaptable CRM software in the market.
  • Force.com Platform – This is the platform-as-a-service offering of Salesforce.
  • Chatter – Think of chatter as a Facebook for enterprise! It facilitates real time collaboration at workplace bringing people, data, and content together in a secure, and trusted network.
  • AppExchange – AppExchange is a directory of applications built for Salesforce by third-party developers, which users can purchase and add to their Salesforce environment.
  • Customization – This is the core essence of Salesforce’s CRM application. User defined fields can be added and existing fields modified to better align the application with the in-use terminology within the company.
  • Web services – Salesforce offers a SOAP Web service API (An XML based method of sending and receiving information between applications via HTTP protocol) that enables integration with other systems.
  • Mobile support – One of the coolest features of Salesforce is the support for mobile devices, where some important functionality of its CRM can be accessed through mobile devices (currently the supported devices include iphone, Blackberry, Android and Windows based smartphones).
  • Programming Languages – Apex is a programming language that is syntactically similar to Java and is used in customization and implementation of applications.

 

Salesforce Workflow Rule Evaluation Criteria

created :

  • The workflow rule will be evaluated the rule criteria when a record is created. If the rule criteria is met, run the rule.
  • With this option, the rule never runs more than once per record.

created, and every time it’s edited :

  • The workflow rule will be evaluated the rule criteria each time a record is created or updated. If the rule criteria is met, run the rule.
  • With this option, the rule repeatedly runs every time a record is edited, as long as the record meets the rule criteria.
  • We cannot add time-dependent actions to the rule if you select this option.

created, and any time it’s edited to subsequently meet criteria :

  • The workflow rule will be evaluated the rule criteria each time a record is created or updated.
  • For a new record, run the rule if the rule criteria is met.
  • For an updated record, run the rule only if the record is changed from not meeting the rule criteria to meeting the rule criteria.
  • With this option, the rule can run multiple times per record, but it won’t run when the record edits are unrelated to the rule criteria.
  • For example, Suppose the Director wants to be notified when an Opportunity value is > $50,000. Using this criteria, the rule would fire when the Opportunity is created with a value $60,000 and the Director would get an email notifying him of this Opportunity. Now if the record is changed from a value of $60,000 to $75,000 the rule does not fire again because it has already met the criteria at its initial creation. Now if the reverse happened, and the value went from $60,000 to $40,000 nothing would happen since the record doesn’t meet the criteria for the rule. But, if in another subsequent change, the value increased to $55,000 the criteria would again be met, and since the record didn’t previously meet the criteria during the last change, the rule would again fire and the Director would receive a new alert.