Wednesday, March 21, 2012

Exporting Old (Archived) Tasks

Recently I was needing to extract all activity history to do a mass reassignment of the tasks. I used APEX data loader and the export function to pull out what I thought was all tasks. I noticed that the dates were only dating back about a year.

Apparently items with the following criteria are marked as 'Archived' in Salesforce.

  • Events with a create date greater than 365 days old
  • Closed tasks with a due date greater than 365 days old
  • Closed tasks without a due date that were created more than 365 days ago

In order to pull out ALL activities you need to use the Export All function in APEX data loader. A single export of all activities with no criteria will return all archived and non-archived results.

Here is a link to the Salesforce support question. 

Thursday, March 15, 2012

Entering a Specific Date in APEX

I was trying to assign a calendar date like this

q2.Calendar_Date__c = '03-14-2012';

That doesn't work! You have for create a new Date Instance like this....

q2.Calendar_Date__c = date.newInstance(2011, 03, 14);


This is the board the I found this on: (Thank you Bob Buzzard!)

http://boards.developerforce.com/t5/Apex-Code-Development/Date-Variable/m-p/197399/highlight/true#M33430