This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.44 KB  |  views: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. DATE(
  2.     YEAR(TODAY()),
  3.     MONTH(TODAY()),
  4.     CASE( MONTH(TODAY()),
  5.         1, 31,
  6.         2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28),
  7.         3, 31,
  8.         4, 30,
  9.         5, 31,
  10.         6, 30,
  11.         7, 31,
  12.         8, 31,
  13.         9, 30,
  14.         10, 31,
  15.         11, 30,
  16.         12, 31,
  17.         DAY(TODAY())
  18.     )
  19. )
  20.        
  21. for(My_Object__c o : trigger.new){
  22.     o.Contract_End_Date__c = o.Contract_Start_Date__c.addMonths(o.Contract_Length__c);
  23. }
clone this paste RAW Paste Data