Wednesday 27 August 2014

How to fire trigger only on Selected Day in salesforce


To achieve that trigger only works on selected day means,

Formatting Date

  1. Date d = System.Today();
  2. // you need to format date to date/time in order to format.
  3. DateTime dt = DateTime.newInstance(d.year(), d.month(), d.day());
  4. String todayDay = dt.format('EEEE');
  5. if(todayDay != 'Saturday' || todayDay !='Sunday')
  6. {
  7.     // Process your logic.
  8. }

Formatting Date/Time 

  1. DateTime dt = System.now();
  2. String todayDay = dt.format('EEEE');
  3. if(todayDay != 'Saturday' || todayDay !='Sunday')
  4. {
  5.     // Process your logic.
  6. }

1 comment:

  1. Is Salesforce your passion... Looking for an extra-ordinary training session, new to coding, worried about placements
    We are here to help you
    "Attend the free demo (write to us on hello@diac.co.in for confirming your timing)
    Refer you friends and get great discounts
    Salesforce Developer and Admin Training along with Certification Training
    Highly optimized and easy to learn Salesforce online training which includes Salesforce ADMIN, DEVELOPMENT, LIGHTNING, BUSINESS ANALYST.
    Call us @91-9310096831

    ReplyDelete

Activities: Assign Tasks to a Queue Salesforce Lightning

Salesforce announced to assign Tasks to a Queue beginning from Spring'20 release. How does it work? In Setup, enter Queues in th...