Friday, September 20, 2013

Indent keyboard shortcut in Gmail

I am always having to google this because I forget it, so I thought I would put it up here for reference...

  • Ctrl-] (Windows, Linux) or Command-] (Mac): Indent text (more)
  • Ctrl-[ (Windows, Linux) or Command-[ (Mac): Remove or lessend text indentation

Tuesday, September 3, 2013

Flags, Stoplights and Images in Salesforce Formula Fields

Below are the examples Salesforce gives you for creating formula fields that will display images such as flags, and stoplights. At the bottom is a link for the full knowledge article.

Flags for Case Priority

This formula displays a green, yellow, or red flag image to indicate case priority.
IMAGE( 
CASE( Priority, 
"Low", "/img/samples/flag_green.gif",
"Medium", "/img/samples/flag_yellow.gif",
"High", "/img/samples/flag_red.gif", 
"/s.gif"), 
"Priority Flag")

Color Squares for Case Age

This formula displays a 30 x 30 pixel image of a red, yellow, or green, depending on the value of a Case Age custom text field.
IF( Case_Age__c > 20, 
IMAGE("/img/samples/color_red.gif", "red", 30, 30),
IF( Case_Age__c > 10,
IMAGE("/img/samples/color_yellow.gif", "yellow", 30, 30),
IMAGE("/img/samples/color_green.gif", "green", 30, 30),
))

Traffic Lights for Status

This formula displays a green, yellow, or red traffic light images to indicate status, using a custom picklist field called Project Status. Use this formula in list views and reports to create a “Status Summary” dashboard view.
IMAGE( 
CASE(Project_Status__c, 
"Green", "/img/samples/light_green.gif",
"Yellow", "/img/samples/light_yellow.gif",
"Red", "/img/samples/light_red.gif", 
"/s.gif"), 
"status color")

Stars for Ratings

This formula displays a set of one to five stars to indicate a rating or score.
IMAGE( 
CASE(Rating__c, 
"1", "/img/samples/stars_100.gif",
"2", "/img/samples/stars_200.gif",
"3", "/img/samples/stars_300.gif", 
"4", "/img/samples/stars_400.gif", 
"5", "/img/samples/stars_500.gif", 
"/img/samples/stars_000.gif"), 
"rating")

Consumer Reports™—Style Colored Circles for Ratings

This formula displays a colored circle to indicate a rating on a scale of one to five, where solid red is one, half red is two, black outline is three, half black is four, and solid black is five.
IMAGE( 
CASE(Rating__c, 
"1", "/img/samples/rating1.gif",
"2", "/img/samples/rating2.gif",
"3", "/img/samples/rating3.gif", 
"4", "/img/samples/rating4.gif", 
"5", "/img/samples/rating5.gif", 
"/s.gif"), 
"rating") 

Horizontal Bars to Indicate Scoring

This formula displays a horizontal color bar (green on a white background) of a length that is proportional to a numeric score. In this example, the maximum length of the bar is 200 pixels.
IMAGE("/img/samples/color_green.gif", "green", 15, Industry_Score__c * 2) & 
IMAGE("/s.gif", "white", 15, 
200 - (Industry_Score__c * 2))


https://help.salesforce.com/apex/HTViewHelpDoc?id=useful_advanced_formulas.htm&language=en#ImageFormulasTitle



Wednesday, August 21, 2013

SqlError: FILESTREAM feature is disabled

I recently ran into this filestream SQL error when trying to restore a backup database. I have restored many databases in the past with no problem so I was a bit confused by the error. After googling it I found this post and it helped to fix the error!

http://brianseekford.com/index.php/2011/05/17/how-to-fix-sqlerror-filestream-feature-is-disabled/

Essentially you need to follow the steps below:


  1. Open SQL Configuration Manager and locate your database then right click on it and open up the properties
  2. Navigate to the FILESTREAM tab and check all the checkboxes then click apply
  3. Right click on your database again and restart it
  4. Close SQL Server Management Studio if it was opened then open it up again
  5. Run the query below
    1. EXEC sp_configure filestream_access_level, 2
    2. RECONFIGURE
  6. Close SQL Server Management Studio and reopen it
  7. Now you should be able to restore the database!



Monday, July 29, 2013

Eclipse Force.com IDE Issue Resolved

Over the years I have run into problem after problem with the Eclipse Force.com IDE. Once it is working I try not to touch anything to prevent it from breaking again!

I wanted to outline the issue I recently ran into and how I resolved it.

Whenever I tried to create a project or refresh an exiting project I was getting this error:

com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

After researching it, primarily on the Developer discussion boards (this one specifically: http://boards.developerforce.com/t5/General-Development/Unable-to-refresh-resource/m-p/333759#M60381 ) I tried the solutions that were suggested in changing workspaces and running as an admin and neither of those worked. So I decided to downgrade the Java JRE from 7 to 6 and this worked!

I went here to download JRE 6 http://www.oracle.com/technetwork/java/javase/downloads/jre6-downloads-1637595.html then before I installed JRE 6 I uninstalled JRE 7 from the control panel.

To check what version of Java was currently running I went to the command prompt and typed in 'java -version' below is what output:

java version "1.7.0_05" ..... before I removed version 7

java version "1.6.0_34" .... after in uninstalled version 7 from the control panel

After that I started up the force.com IDE and everything worked perfectly! 

Tuesday, July 23, 2013

Using Apex Variables in SOQL and SOSL Queries (SOQL IN Clause)

I spent some time looking for this documentation around using the SOQL IN clause with a list and wanted to save it.

I basically want to run a SOQL query that is looking at a list of String values in the WHERE condition, like this:

// An IN-bind with an Id list. Note that a list of sObjects
// can also be used--the Ids of the objects are used for 
// the bind
Contact[] cc = [SELECT Id FROM Contact LIMIT 2];
Task[] tt = [SELECT Id FROM Task WHERE WhoId IN :cc];

// An IN-bind with a String list
String[] ss = new String[]{'a', 'b'};
Account[] aa = [SELECT Id FROM Account 
                WHERE AccountNumber IN :ss];


http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_variables.htm

Sunday, July 21, 2013

Basic For Loop

Below is a basic example of a for loop. I always seem to need to need this and forget the exact context.


trigger OpportunitySubmitForApproval on Opportunity (after update) {
 
 for (Integer i = 0; i < Trigger.new.size(); i++) {
 
  if (Trigger.old[i].Probability < 30 && Trigger.new[i].Probability >= 30) {
 
   // create the new approval request to submit
   Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
   req.setComments('Submitted for approval. Please approve.');
   req.setObjectId(Trigger.new[i].Id);
   // submit the approval request for processing
   Approval.ProcessResult result = Approval.process(req);
   // display if the reqeust was successful
   System.debug('Submitted for approval successfully: '+result.isSuccess());
 
  }
 
 }
 
}

Friday, May 24, 2013

Goldmine SQL Query to Filter on Date

Below is a basic query that will output the results of all ContHist records from 1/1/2009 and forward.

select * from CONTHIST where ondate > '2009-01-01'