Newer Version Available

This content describes an older version of this product. View Latest

Try It Out: Create the New Position Workflow Rule and Alert

Now that we've built our email template, we're ready to build the workflow rule and email alert that use it. By now this procedure should be very familiar to you:
  1. From Setup, enter Workflow Rules in the Quick Find box, then select Workflow Rules.
  2. Click New Rule.
  3. In the Object drop-down list, choose Position and click Next.
  4. In the Rule Name text box, enter Email New Position Alert.
  5. In the Description text box, enter Send an email to everyone whenever a position record is opened.

We only want this rule to execute when a position record's status changes to Open - Approved.

  1. In the Evaluate the rule when a record is: field, select created, and any time it’s edited to subsequently meet criteria.
  2. In the first row of rule criteria:
    • Set the Field to Position: Status.
    • Set the Operator to equals.
    • Set the Value to Open - Approved. Although New Position is the default value of the Status picklist, we only want to publicize those positions that have been approved for hire by an executive.
  3. Click Save & Next.
Now let's create the email alert for this workflow rule:
  1. In the Immediate Workflow Actions area, click Add Workflow Action, and select New Email Alert.
  2. In the Description text box, enter Email New Position Alert.
  3. Next to the Email Template field, click the lookup icon (Lookup icon), and select Recruiting App: New Position Alert.

We want to send this email to everyone at Universal Containers, but for this workflow rule there's no obvious way of doing that. We can work around this by relying on our role hierarchy and sending the email to everyone in the CEO role and its subordinates.

  1. In the Recipient Type Search field, choose Role and Subordinates.
  2. In the Available Recipients list, select Role and Subordinates: CEO and click Add.
  3. Click Save.
  4. Click Done.
  5. Click Activate.

And that's all there is to it! To test out this workflow rule, all you need to do is create a new position record with a status of Open - Approved. Within a few seconds, all users within your organization will receive an email letting them know that a position has just been created. Go ahead—try it!

Beyond the Basics

Did you know you can use the Developer Console to troubleshoot Apex, workflow rules, and validation logic?

Say you want to debug a workflow rule that isn't working correctly. You can use the console to step through the execution log of everything that occurred during the request, line by line, until you find the problem.

To find out more, click Help in the Developer Console.