• #29633
    Salesforce | Sanjana Sanjana #644
    Forcetalks

    Can we use Workflow Rules with Time Triggers in Salesforce?

    Can we use Workflow Rules with Time Triggers in Salesforce?

     

    #30774
     Anjali #643
    Forcetalks

    Hi Sanjana,

    Triggers will execute if the time-based workflow rule creates or modifies a record. This means that a time-based workflow rule can create a task and it will execute (before and after insert) task triggers, or you can use a Workflow Field Update to change a field value, thus triggering (before and after update) object triggers. Those triggers can, in turn, trigger a time-based workflow…. Before scheduling, people used this mechanism to create recurring system tasks.

    #34036
    Salesforce | Parul Parul #160
    Forcetalks

    Yes you can use trigger will execute on specified time-based-workflow.

     

    Thanks

    #34386
    Salesforce | shariq shariq #839
    Forcetalks

    Hi,

    Time Trigger Processing

    • Time-dependent actions aren’t executed independently. They’re grouped into a single batch that starts executing within one hour after the first action enters the batch.
    • Apex triggers that fire as a result of time-dependent actions may get executed in a single batch or independently. Follow these best practices:
      • In case they fire independently–Ensure that your Apex logic is scoped for a single scheduled action. For example, don’t use Apex static variables to communicate state across Apex code triggered by different scheduled actions.
      • In case they fire in a single batch–Be aware of how the combination of your time-dependent actions and Apex triggers impact your Apex governor limits.
    • Salesforce evaluates time-based workflow on the organization’s time zone, not the user’s. Users in different time zones might see differences in behavior.
      Salesforce doesn’t necessarily execute time triggers in the order they appear on the workflow rule detail page. Workflow rules list time triggers that use the Before field first, followed by time triggers that use the After field.
    • Salesforce doesn’t display time-dependent action controls on the workflow rule edit page if you set the workflow rule evaluation criteria to Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria.
    • If you change a date field that is referenced by an unfired time trigger in a workflow rule that has been evaluated, Salesforce recalculates the unfired time triggers associated with the rule. For example, if a workflow rule is scheduled to alert the opportunity owner 7 days before the opportunity close date and the close date is set to 2/20/2011, Salesforce sends the alert on 2/13/2011. If the close date is updated to 2/10/2011 and the time trigger hasn’t fired, Salesforce reschedules the alert for 2/3/2011. If Salesforce recalculates the time triggers to a date in the past, Salesforce triggers the associated actions shortly after you save the record.
    • If a workflow rule has a time trigger set for a time in the past, Salesforce queues the associated time-dependent actions to start executing within one hour. For example, if a workflow rule on opportunities is configured to update a field 7 days before the close date, and you create an opportunity record with the close date set to today, Salesforce starts to process the field update within an hour after you create the opportunity.
    • Time-dependent actions remain in the workflow queue only as long as the workflow rule criteria are still valid. If a record no longer matches the rule criteria, Salesforce removes the time-dependent actions queued for that record.For example, an opportunity workflow rule can specify:
      • A criteria set to “Opportunity: Status not equals to Closed Won, Closed Lost”
      • An associated time-dependent action with a time trigger set to 7 days before the opportunity close date
        If a record that matches the criteria is created on July 1 and the Close Date is set to July 30, the time-dependent action is scheduled for July 23. However, if the opportunity is set to “Closed Won” or “Closed Lost” before July 23, the time-dependent action is removed from the queue.
    • Salesforce ignores time triggers that reference null fields.
    • Time-dependent actions can automatically be queued again if the record is updated and the evaluation criteria is set to Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria. Using the previous example, if the opportunity status is changed from Closed Lost to Prospecting and the workflow rule evaluation criteria is Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria, Salesforce reevaluates the time triggers and adds the appropriate actions to the workflow queue.
    • Deleting a record that has pending actions removes the pending actions from the workflow queue. You can’t restore the actions, even if you undelete the record.
    • If the evaluation criteria is set to Evaluate the rule when a record is: created, the workflow rule evaluates its time triggers only once. If the record that fired the rule changes to no longer meet the evaluation criteria, Salesforce removes the pending actions from the queue and never reapplies the rule to the record.
    • You can deactivate a workflow rule at any time. If the rule has pending actions in the workflow queue, editing the record that triggered the rule removes the pending actions from the queue. If you don’t edit the record, the pending actions are processed even though the rule has been deactivated.
    • Time-dependent actions aren’t executed for a reevaluated workflow rule in the following situations:
      • The reevaluated workflow rule’s immediate actions cause the record to no longer meet the workflow rule criteria.
      • An Apex after trigger that is executed as a result of a workflow or approvals action causes the record to no longer meet the workflow rule criteria.
    • Configuring a task’s Due Date to “Rule Trigger Date” sets time triggers and workflow task due dates based on the date that the workflow time trigger’s action is executed. For example, if the task due date is “Rule Trigger Date plus 10 days” and the time trigger is executed on January 1, Salesforce sets the task due date to January 11.
    • You can add a new active workflow rule with time triggers in a change set and deploy it. You can only change time triggers on a workflow rule in a change set if it’s inactive. The rule must be activated in the destination organization manually or through another change set that only activates workflow rules and makes no time trigger changes.For example, let’s say you have an inactive workflow rule in your destination organization, and your change set contains an active workflow rule with the same name and new or different time triggers. The deployment fails because it activates the workflow rule first and then tries to add or remove the time triggers

    Hope this helps.

Viewing 4 posts - 1 through 4 (of 4 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?