Configure an Approval Process for Opportunities

In this example, you learn how to set up approvals for opportunities using a business process flow provided by Oracle.

The approval process outlined in the diagram is triggered when a condition you enter as a Groovy script is true. In this example, the process is triggered when a salesperson enters an opportunity revenue amount greater than USD 100,000. Here's what happens when the process is triggered:

  1. The approval process sends approval requests to one or more users.

    In this example, the notification is sent to one user. If you specify multiple users, then all users must approve before the opportunity is considered approved.

    You can enter identifying information into the subject line of the approval notification to help approvers understand what they're approving. In this example, you enter the opportunity name and the account. The body of the notification includes the name of the person who updated the opportunity.

  2. The approval process updates the approval status to PENDING APPROVAL to indicate that an approval request was sent.

    In this example, you create a custom field to display the status on the Edit Opportunity page.

  3. After the approver views the notification and clicks the Approve or the Reject button, the process updates the status to APPROVED or REJECTED and sends a confirmation back to the user who updated the opportunity.

  4. Optionally, the process can send an informational e-mail about the process outcome to the recipients of your choice.

Approval process described in the text

You create the object workflow that triggers the approval process using Application Composer while working in a sandbox, so you can test the process before publishing it.

The overall configuration of the approval process includes these steps:

  1. Create a custom text field to display the approval status.

  2. Add the custom field to the Edit Opportunity page.

  3. Create an object workflow that triggers the approvals business process provided by Oracle and supplies the required inputs, including the name of the user who receives the approval notification.

  4. Test the approval process before publishing it.

Create a Custom Field to Display the Approval Status

  1. Sign in as a sales administrator or a setup user.

  2. Activate an existing sandbox with Application Composer as one of the available tools, or create a new one.

    The sandbox name appears at the top of the page.

  3. Navigate to Application Composer.

  4. In the left pane, expand Standard Objects.

  5. Expand Opportunity.

  6. Click Fields.

  7. On the Fields page, Custom tab, select Create from the Action menu.

  8. In the Select Field Type window, select Text.

  9. Click OK.

  10. On the Create Text Field page, in the Display Label field in the Appearance region, enter Large Deal Approval.

    The applications creates the technical name and API Name based on your entry. The API name is the name followed by an underscore and the letter c (_c). You enter the API name as one of the parameters of the workflow to indicate this is the field that displays the approval status.

  11. Click Save and Close.

You're now ready to display the custom field on the Edit Opportunity page.

Display the Custom Field on the Edit Opportunity Page

  1. In the Application Composer left pane, select Pages under Opportunity.

  2. On the Opportunity: Pages page, Application Pages tab, scroll down to Details Page Layouts section and edit any custom layout. If none exists, then duplicate the standard layout and edit the resulting custom layout.

  3. In the Subtabs region, click Edit for the Summary.

  4. In the Edit Summary page, move the Large Deal Approval field from the Available Fields box to the Selected Fields box.

  5. Click Save and Close.

  6. Click Done.

  7. Click the Application Composer link at the top left corner of the screen to return to the Application Composer Overview page.

Create an Object Workflow to Trigger the Approval Flow

With the sandbox still active, configure an object workflow with the trigger condition and the inputs to pass to the approvals process.

  1. On the Application Composer page, make sure that Sales is still selected as the Application.

  2. Click Object Workflows.

  3. On the Object Workflow page, select Create from the Actions menu.

  4. On the Create Object Workflows page, select Opportunity from the Object list.

  5. Enter Deal amount more than USD 100000 in the Name field.

  6. In the Event Point and Condition region:

    1. Select the When a record is updated option.

    2. Click the Groovy Builder icon, highlighted with callout 1 in the screenshot

      Create Object Workflow page

      In the Expression Builder window, enter the Groovy script: if (nvl(Revenue,0)>100000 && isAttributeChanged('Revenue')) return true;

      You can ignore the warning.

    3. Click OK.

  7. In the Actions region, click Create (the plus icon on the right side of the page) for Business Process Flow.

  8. In the Create Action: Business Process Flow page, enter Opportunity Approval in the Name field.

  9. In the Project Name field, search and select ExtnBusinessProcessComposite. This is the name of the approval business process provided by Oracle.

  10. The Inputs region lists the parameters you can pass to the business process. In the Inputs region, make the following entries:

    1. In the approvers field, enter the user name of the user who's to receive the approval notifications in single quotation marks. For example:'lisa.jones'.

    2. In the heldEntityStatusField, enter the API name of the custom field you created in single quotation marks. For example: 'LargeDealApproval_c'.

    3. In the emailAddress field, enter the e-mail addresses in single quotations of people you want to be notified of the process outcome. Separate multiple e-mails with commas. For example: 'JoanneWong@nomail.com', 'tanakas@nomail.com'

    4. In the title1 and title2 fields, enter the two fields that you want to display in the subject line of the notification:

      The notification subject line appears as: Opportunity <title1><title2> Is Submitted for Your Approval

      In this example, we are adding the opportunity name and the account fields, so make the following entries in the Default Value field:

      • For title1, enter Name.

      • For title2, enter AccountName.

      You can view all of the fields available for insertion, by clicking Select Default Value, the function icon to the right of the field, highlighted by callout 1 in the screenshot.

      Create Action: Business Process Flow page

      Here's how to insert a field:

      1. Select the field.

      2. Click Insert to move the field to the Value region.

      3. Click OK.

  11. Click Save and Close.

Test the Approval Flow

To test the approval flow, create an opportunity and enter a revenue amount greater than USD 100,000. Then sign in as the approver to view the notification and approve.

  1. While signed in as the same user who performed the setup, click the Home icon to return to the springboard.

  2. Double-click on the Sales icon and on the Opportunities icon to open the Opportunities work area.

  3. Click Create Opportunity.

  4. In the Create Opportunity page, enter a name.

  5. Click Save and Continue.

  6. On the Edit Opportunity page, click Add in the Products region to add a revenue line to the opportunity.

    Notice that the Large Deal Approval field you added to the page doesn't display a status. This is because the approval flow is not triggered yet.

  7. Enter a product group or a product and an amount greater than 100000 to trigger the approval workflow.

  8. Click Save and Close.

    Saving triggers the approvals process.

  9. Wait a few minutes to let the approval process run and view the opportunity again. The Large Deal Approval field now displays PENDING APPROVAL.

  10. Sign out by clicking the user name and the Sign Out link.

  11. Sign in as the approver.

  12. Click Notifications (the bell icon) at the top of the screen.

    The Recent Notifications window displays the new approval notification.

  13. Click the notification subject line to display the notification body and click Approve .

  14. Sign out and sign in again as the administrator.

  15. Click Notifications (the bell icon) at the top of the screen.

    The Recent Notifications window displays the approval confirmation.

  16. Navigate back to the Opportunities work area and view the opportunity you created.

  17. The Large Deal Approval field displays APPROVED.

  18. You must publish the Sandbox if you want to make the opportunity approval available for use.