Configure Object Workflows

This example demonstrates how to create an object workflow and set a trigger condition for invoking (or launching) the workflow. The trigger condition that will launch the workflow will be when the budget availability date for an opportunity is updated.

As part of the example, you configure these three event actions:

  • Field Updates: Set the opportunity Close Date to 7 days from the new budget availability date. Additionally, lower the Level of Risk for the opportunity and set the Strategic Value to Medium.

  • Task Creation: Create a task for the opportunity owner to follow up with the customer.

  • E-mail notification: First, create an e-mail template for sending e-mail notifications. Then, notify the entire opportunity team about the change in the budget availability date using e-mail.

This example has been split into the following steps:

  1. Creating a workflow and setting its trigger condition.

  2. Configuring a Field Updates event action.

  3. Configuring a Task Creation event action.

  4. Creating an E-Mail Template and then creating an E-Mail Notification event action.

  5. Creating an Opportunity record.

  6. Editing the Opportunity Record to Trigger the Workflow and Verifying the Invoked Event Actions.

1. Creating an Object Workflow and Setting its Trigger Condition

In this example, you create an object workflow using an Opportunity object and create a trigger condition for the workflow using Groovy script. When the budget availability date is changed, the workflow will be triggered.

  1. Click the Navigator menu.

  2. Click the Application Composer link.

    Note: You might need to click the more >> link if you don't see Application Composer.

    The Overview page of Application Composer appears. This page shows the various tasks available to modify and extend your application. In this activity, you are configuring a workflow for the Opportunity object.

  3. In the Overview region, click the Object Workflows link.

    The Object Workflows page appears. You can use this page to search for an existing workflow or create a workflow. In this activity, you create a workflow.

  4. Click the Actions menu below the Search region.

  5. Click the Create menu item.

    The Create Object Workflow page appears.

  6. You must first select an object for which you are creating a workflow. Click the Object list.

  7. Click the Opportunity list item.

  8. Enter "Budget Date Revised" in the Name field.

  9. In the Event Point and Condition region, click the When a record is updated option.

  10. You set the trigger condition using Groovy script. Launch the expression builder to create the condition. In the Event Point and Condition region, click the expression builder button to open the expression builder.

    The Expression Builder dialog appears.

  11. Before you proceed, ensure that the Fields tab is selected.

  12. Identify the correct application programming interface (API) name for the field you want to use for defining your trigger condition. Under the Display Label column in the Opportunity: Fields table, locate and click the Date Budget Available cell.

  13. Insert Date Budget Available into the expression builder. Click the Insert button.

  14. Enter your script in the Expression area using the BudgetDateAvailable field you just inserted. Write a script that meets all of these conditions:

    1. Only the BudgetAvailableDate is updated.

    2. The BudgetAvailableDate is not null.

    3. The opportunity record that you create is updated.

    The following script has been written for you using the BudgetDateAvailable field:

    if(isAttributeChanged('BudgetAvailableDate') && 'BudgetAvailableDate' != null && contains(Name, ' 50 Solar Green Servers')) { return true; } else { return false; }

  15. Validate your script. Click the Validate button.

  16. Click the OK button.

  17. You have set the event point and trigger condition for your object workflow. You now create a Field Updates event action. In this event action, you specify the values with which the Close Date, Level of Risk, and Strategic Value values will be replaced when the field updates action is triggered.

2. Configure a Field Update Event Action

Continuing from the previous step, you are on the Create Object Workflow page. In this step, you configure Field Updates event action for the object workflow and set new values for fields when the workflow is triggered.

  • Set the Close Date to 7 days from the new budget availability date.

  • Lower the Level of Risk from High to Low.

  • Set the Strategic Value to Medium.

  1. In the Actions region, click the Create button on the right of the Field Updates action.

    The Create Action: Field Updates page appears.

  2. Enter "Update Close Date" in the Name field.

  3. In the Execution Schedule region, keep the default setting, which is to update fields right away when the workflow is triggered.

  4. In the Field Update Details region, click the Field to Update list.

  5. Click the Close Date list item.

  6. Click the Value list.

  7. Click the Date Budget Available list item.

  8. Make sure the '+' operator is selected, and enter "7" in the Days field.

  9. Click the Update More Fields link.

  10. Click the Field to Update list.

  11. Click the Level of Risk list item.

    You will lower the Level of Risk for an opportunity when the workflow is triggered. The values in the Level of Risk field are in a descending order of High, Low, and None; therefore, when you select the Populate with next value in list option for Level of Risk, the risk level will be lowered by one step. For example, if the initial value is High, it will change to Low when the workflow is invoked, because Low is the next value in the list.

  12. Click the Populate with next value in list option.

  13. Click the Update More Fields link.

  14. Click the Field to Update list.

  15. Click the Strategic Value list item.

  16. Click the list on the right of the Value group of options.

  17. Click the Medium list item.

  18. Save the Field Update event action. In the upper-right region of the page, click the Save button.

    You're back to the Create Object Workflow page. Now you create a Task Creation event action for the sales team to follow up with the customer.

3. Configuring a Task Creation Event Action

Continuing from the previous step, you are on the Create Object Workflow page. In this example, you configure a Task Creation event action for an object workflow. A task will be created for the opportunity owner to follow up with the customer.

  1. In the Actions region, click the Create button on the right of the Task Creation event action.

  2. Enter "Follow Up Call" in the Name field.

  3. In the Task Details region, enter "Follow up with customer on budget available date" in the Subject field.

  4. You now insert a field token in the Subject field. Place your cursor where you want the token to appear. In the Subject field, click after "customer".

  5. Click the field-token list on the right of the Subject field.

  6. Click the Customer list item.

  7. Click the << Insert button.

    Notice that the [$TargetPartyName$] token is inserted in the Subject where you placed your cursor. You need to adjust trailing or leading text-spaces as required.

  8. Enter "Opportunity Budget Available Date is changed. Follow up with within three days of the new available date. Primary Contact Email ID: " in the Description field.

  9. Use the field-token list on the right of the Description field to insert the following tokens one by one into the description text:

    • Opportunity Name ([$Name$])

    • Primary Contact ([$PrimaryContactPartyName$])

    • Primary Contact E-Mail ([$PrimaryContactEmailAddress$])

  10. Click after "Opportunity" in the Description text.

  11. Click the field-token list on the right of the Description field.

  12. Click the Opportunity Name list item.

  13. Click the <<Insert button.

  14. Click after "Follow up with" in the Description text.

  15. Click the field-token list on the right of the Description field.

  16. Click the Primary Contact list item.

  17. Click the <<Insert button.

  18. Click after "Email ID:" in the Description text.

  19. Click the Primary Contact E-Mail list item.

  20. Click the <<Insert button.

  21. You will now set the task's Due Date to be 3 days after the new Budget Available Date. Click the Due Date list.

  22. Click the Date Budget Available list item.

  23. Make sure the plus sign +operator is selected, and use the increment button (up arrow) to set the value in the Days field to 3.

  24. Click the Start Date list.

  25. Click the Date Budget Available list item. Accept the default 0 (zero) in the Days field.

  26. Click the Owner list.

  27. Click the OwnerResourcePartyid list item.

  28. Click the Assignees list.

  29. Click the OpportunityResource Team list item.

  30. Click the Category list, then click the Call, outbound list item..

  31. Click the Priority list, then click the 1 - Very high list item.

  32. Save the Task Creation event action. In the upper-right region of the page, click the Save button.

  33. You are back to the Create Object Workflow page. In the upper-right region of the page, click the Save button. This saves the object workflow.

    You now create the E-Mail Notification event action. Before you create this event action, you must first create an E-Mail Template that you use for sending e-mail notifications.

4. Creating an E-Mail Template and Configuring an E-Mail Notification Event Action

Continuing from the previous step, you are now on the Object Workflows page. In this step, you create an e-mail template, which you use for sending e-mail notifications.

  1. In the Common Setup pane on the left, click the E-Mail Templates link.

    You are on the E-Mail Templates page. You can use this page either to search and edit an existing template or to create a fresh template. In this activity, you create a template.

  2. In the Search Results region, click the Actions menu.

  3. Click the Create menu item.

    The Create E-Mail Template page appears.

  4. Click the Object list.

  5. Click the Opportunity list item.

  6. Enter Budget Available Date Update" in the Name field.

  7. Enter "Opportunity customer budget available date has changed" in the E-Mail Subject field.

  8. You now insert a field token in the E-Mail Subject field. Place your cursor where you want the token to appear. Click after "Opportunity" in the E-Mail Subject field.

  9. Click the field-token list on the right of the E-Mail Subject field.

  10. Click the Opportunity Name list item.

  11. Click the <<Insert button

  12. In the E-Mail Body region, enter "- budget available date regarding opportunity has moved to . The new opportunity close date is ." in the E-Mail Body field.

  13. In the E-Mail Body region, use the Fields list item of the Select list to insert the following field tokens:

    Field

    Token

    Customer

    [$PartyUniqueName$]

    Opportunity Name

    [$Name$]

    Date Budget Available

    [$BudgetAvailableDate$]

    Close Date

    [$EffectiveDate$]

    Note: Rich text formatting is available only if your e-mail account supports HTML format e-mail.
  14. Click after "- " in the e-mail body.

  15. In the E-Mail Body region, click the field-token list on the left of the Insert button.

  16. Click the Customer list item.

  17. Click the Insert button.

  18. Click after "regarding opportunity" in the e-mail body.

  19. Click the field-token list.

  20. Click the Opportunity Name list item.

  21. Click the Insert button.

  22. Click after "has moved to" in the e-mail body.

  23. Click the field-token list.

  24. Click the Date Budget Available list item.

  25. Click the Insert button.

  26. Click after "close date is" in the e-mail body.

  27. Click the field-token list.

  28. Click the Close Date list item.

  29. Click the Insert button.

  30. Save the E-Mail Template. In the upper-right region of the page, click the Save button.

    You're returned to the E-Mail Templates page.

  31. In the Common Setup pane on the left, click the Object Workflows link.

    You now create an E-mail Notification event action using the e-mail template you just created.

  32. In the Search region, click the Object list.

  33. Click the Opportunity list item.

  34. Click the Search button.

    The Name column in the search results lists the object workflows created for the opportunity object. From this list, you identify and select the object workflow that you are creating.

  35. Click the Budget_Date_Revised cell.

  36. Click the Edit button.

    The Edit Object Workflow page appears. You are editing an existing object workflow to configure and add an E-Mail Notification event action.

  37. In the Actions region, click the Create button on the right of the E-Mail Notification event action.

    The Create Action: E-Mail Notification page appears.

  38. Enter "Notify sales team about budget available date change" in the Name field.

  39. Select the e-mail template that you created. In the E-Mail Details region, click the E-Mail Template list.

  40. From the list of e-mail templates, identify and select the template that you created. Click the Budget Available Date Update template.

  41. Click the Recipient Type list.

  42. Click the Specific e-mail addresses list item.

  43. Enter the desired information into the E-Mail Addresses field.

  44. Save the E-Mail Notification event action. In the upper-right region of the page, click the Save button.

    You are returned to the Edit Object Workflow page.

  45. Save the object workflow. In the upper-right region of the page, click the Save button.

    You have now configured an object workflow with three event actions. This object workflow is invoked (launched) when you update the budget available date for the opportunity that you create.

5. Creating an Opportunity Record

In this section, you trigger the object workflow that you created in the previous steps by entering the budget availability date for an opportunity. You note down the details where the changes will occur after the workflow is triggered.

  1. Click the Navigator menu.

  2. Click the Opportunities link under Sales.

    The Overview page of Opportunities appears. You use this page to create an opportunity record.

  3. In the Opportunities region, click the Create button.

    The Create Opportunity page appears.

  4. Verify that Close Date is the current date, Sales Stage is 01-Qualification, and Win Probability (%) is 0 (zero).

  5. In the Name field, enter "50 Solar Green Servers".

  6. In the Sales Account field, enter "Solar Inc (KIRKLAND, US)".

  7. Click the Sales Account search button adjacent to the Sales Account field.

    The Search and Select: Sales Account dialog appears.

  8. In the dialog, the Solar Inc (Kirkland, US) search parameter appears in the Name field. Click the Search button.

  9. In the Search Results region, click the Solar Inc (Kirkland, US) cell.

    Note: Ensure that the All Sales Accounts tab is selected.
  10. Click the OK button.

  11. In the Revenue Items region, click the Add Row button.

  12. Enter "DG 150 Green Servers" in the Name field.

  13. Enter "50" in the Quantity field.

  14. Enter "2000" in the Estimated Price field.

  15. In the upper-right region of the page, click the Save and Edit button.

    The Edit Opportunity page appears.

  16. Expand the following if not already expanded:

    • Show More area in the Summary region.

    • Revenue Items region.

    • Activity Center region.

  17. Locate the following fields and note their current values:

    • Close Date (in the Summary region).

    • Strategic Value (under Show Less area in the Summary region).

    • Level of Risk (under Show Less area in the Summary region).

    • Date Budget Available (under Show Less area in the Summary region).

    When you update the Date Budget Available field to trigger the workflow, the values in the Close Date, Strategic Value, and Level of Risk fields should change.

  18. Under the Show Less area in the Summary region, click the Level of Risk list.

  19. Click the High list item.

  20. In the upper-right region of the page, click the Save button.

  21. You are still on the Edit Opportunity page. In the Activity Center region, click the Tasks tab.

    Currently there are no Tasks with your sign-in initials.

  22. In the Additional Details region, click the Opportunity Team tab.

  23. In the Team Members table, locate your sign-in username. You will now add another team member: Mateo Lopez.

  24. In the Opportunity Team tab, click the Add Team Members button.

    The Select and Add: Team Members dialog appears.

  25. Find a team member and click the Done button.

  26. Search and add a contact to the opportunity. This will be the primary contact for the opportunity.

  27. In the Additional Details region, click the Contacts tab.

  28. In the Contacts tab, click the Add Row button.

  29. Enter the desired information into the Name field. As you type in the contact name, the contact name and e-mail ID appear.

  30. Click the desired contact.

  31. In the upper-right region of the page, click the Save and Close button.

  32. You're back to the Overview page of Opportunities. You will now edit the opportunity record you just created and update the budget availability date to trigger the event actions.

6. Editing the Opportunity Record to Trigger the Workflow and Verifying the Invoked Event Actions

Continuing from the previous step, you are on the Overview page of Opportunities. You will trigger (launch) the object workflow that you created in the previous steps by entering the budget availability date for an opportunity.

You will also verify the following after the workflow is invoked:

  • Field Updates: Verify that the opportunity Close Date is set to 7 days from the new Budget Available Date. Verify that the Level of Risk is lowered for the opportunity and the Strategic Value is set to Medium

  • Task Creation: Verify that a task is created for the opportunity owner to follow up with the customer.

  • E-mail notification: Verify that an e-mail notification is sent to the entire opportunity team about the change in the opportunity's Budget Available Date.

  1. From the table in the Opportunities region, identify and select the opportunity record that you created. Click the 50 Solar Green Servers link.

  2. You are on the Edit Opportunity page. Before you proceed, expand the Show More area in the Summary region if not already expanded.

  3. Under the Show Less area in the Summary region, click the Date Budget Available (calendar) button.

  4. Click 9 as the date, or click any future date.

  5. In the upper-right region of the page, click the Save and Close button.

    Note: You have just changed the budget availability date and saved the record, saving the changes to the database. The object workflow will be evaluated and triggered at this time, and all the event actions will be executed. The Field Updates event action always happens first followed by other event actions in no particular order. It might take a few seconds for the updates to occur.
  6. In the table under the Opportunities region, identify and select the opportunity record that you created. Click the 50 Solar Green Servers link.

    You are on the Edit Opportunity page. The workflow is now triggered and the configured event actions have been invoked. You will now verify the invocation of Field Updates event action.

  7. In the Summary region, Close Date is now set to 7 days after the Date Budget Available value.

  8. Under the Show Less area in the Summary region, Strategic Value is now set to Medium.

  9. Under the Show Less area in the Summary region, Level of Risk has now been populated with the next value in the list, from High to Low.

    You have verified the invocation of the Field Updates event action. Now, you verify the invocation of the Task Creation event action

    In the Activity Center region, the Due Date filter under the Tasks tab may prevent your task from appearing in the invoked tasks list even after it is invoked. For example, a task having a due date after 10 days will not appear if the Due Date filter is set to Next 7 Days. In this activity, you use the All Tasks filter option to search for your invoked task.

  10. In the Activity Center region, click the Due Date list under the Tasks tab.

  11. Click the All Tasks list item.

  12. In the Tasks tab, click the arrow button adjacent to the Category list.

  13. In the Search results, locate the Subject that has your sign-in initials. Click the Follow up with customer Solar Inc on budget available date link.

    You are on the Edit Task page. Note these details:

    • The Owner of the opportunity is the owner of this task.

    • The task Assignees are persons in the opportunity sales team.

    • In the Description field, the field tokens that you had inserted when creating the Task Creation event action have been replaced with values at runtime.

  14. Click the Done button.

  15. In the upper-right region of the page, click the Save and Close button.

    You have verified the invocation of the Task Creation event action. Next, verify the invocation of the E-Mail Notification event action.

  16. In your e-mail client, locate the Subject of your e-mail. Click the Subject link.

  17. Notice that the field tokens that you inserted while configuring the e-mail notification event action have been replaced with values at runtime. You have now verified the invocation of the E-Mail Notification event action.

    You have now verified the invocation of all three event actions.