Você está na página 1de 6

ORACLE SALES CLOUD AND ENGAGEMENT CLOUD – IMPLEMENTATION NOTE

SCHEDULE CUSTOM BUSINESS LOGIC USING GROOVY FOR


DATA PROCESSING

October 4, 2017
[Revised January 15, 2018]

Release 12 and higher


CONTENTS

Overview ...................................................................................................................................... 4

Create an Object Function.................................................................................................................. 4

Schedule the Process ......................................................................................................................... 5

Locating the Object Name ............................................................................................................ 6

Limitations .................................................................................................................................... 6

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 2 of 6
SAFE HARBOR

The following is intended to outline our general product direction. It is intended for information
purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any
material, code, or functionality, and should not be relied upon in making purchasing decisions. The
development, release, and timing of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.

CONTENT SUBJECT TO CHANGE

The information in this document is correct as of the published date. However, Oracle Sales and
Engagement Cloud continues to evolve and software updates are applied frequently; therefore this
information is subject to change. Check with your Oracle Representative for updates.

This content is not warranted to be error-free.

ABOUT THIS DOCUMENT

This document supplements standard product documentation, which you are encouraged to review. To
find documentation and other learning resources, such as guides, whitepapers, and videos, visit the
Help Center for Oracle Sales Cloud.

AUDIENCE

This document is for Oracle Sales and Engagement Cloud (Release 12 and higher) customers involved in
implementation. The tips and techniques detailed in this document may not be suitable for other CX
Applications.

You will need to know how to call a REST service using Chrome Postman or any other tool, to use the
information in this document.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 3 of 6
OVERVIEW

This document describes how to call an object function at a scheduled time using the Enterprise
Scheduler. This can be used if you want to process a set of records on a daily or weekly basis,
asynchronously, where users do not need to see immediate feedback in the user interface.

This document walks through one example to illustrate how this approach is used to update
opportunities that are more than 30 days past the closed date. This would be a better option for batch
processing, rather than defining an object work flow on a record-by-record basis. Here, we configure
custom logic using groovy so it can be as complex as needed, can be long-running without blocking the
user interface, and can be used for batch processing a small set of records per job and break down a job
into manageable chunks.

The following steps show how to create an Object function to update opportunities that are more than
30 days past the closed date.

Steps needed:
1. Create an Object function.
2. Schedule the process.

CREATE AN OBJECT FUNCTION

1. Navigate to Application Composer > Sales Application.


2. Expand the Standard Objects > Opportunities folder and click Server Scripts > select Object
Functions tab.
3. Create an object function named “UpdateOppty” with Visibility set to "Callable by External
Systems."

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 4 of 6
SCHEDULE THE PROCESS

1. Navigate to Scheduled Processes (Tools section of the Navigator).


2. Click the Schedule New Process button.
3. Search for the “Schedule Custom Groovy Object Functions - Developer Preview” job.

4. Enter the following information on the Process details page. Keep in mind that entries on this page
are case-sensitive:
• Application Name (required in R12): the name of the application (such as sales, crmCommon, or
service).
• Object Name: the REST Service resource name of the object for which you defined the object
function (such as opportunities, leads, or activities). See Locating the Object Name for details.
• Object Function Name: the name of the object function you created using Application Composer.

5. Click the Advanced button to schedule the process or to run “As soon as possible” to test it.
6. Click Submit. The process will be scheduled to run based on the options you selected.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 5 of 6
LOCATING THE OBJECT NAME

“Object name” is the REST resource name of the object for which the object function is defined. This is
the API name that the REST service uses to refer to the object. Here are few objects with their REST
resource names.
Object Name REST Resource Name
Opportunity opportunities
Activity activities
Sales Leads leads
Notes notes

To find the REST resource name, see REST API for Oracle Sales Cloud R13 on the Oracle Help Center or
check the result obtained in a REST GET request. The URL for a target system is:

Release 12:

http/s://<host>:<port>/<application name>Api/resources/latest/describe or if you know resource


name you can use the actual resource describe to confirm:
http/s://<host>:<port>/salesApi/resources/latest/activities/describe

Release 13:

http/s://<host>:<port>/crmRestApi/resources/latest/describe or if you know resource name you can


use the actual resource describe to confirm:
http/s://<host>:<port>/crmRestApi/resources/latest/<resource name>/describe

For a custom object, the resource name will end with "_c."

LIMITATIONS

1. Only object functions without parameters can be scheduled for invocation.


2. Break the work into multiple object functions if required due to limitations; object function
execution time is limited to one minute. Also, the maximum fetch size, which controls the number
of rows returned, is set to 500 rows by default. This number can be changed using method
setMaxFetchSize() as mentioned in document Application Composer: Using Groovy Scripts.
3. A record must exist for the object for which you defined the object function. Be sure to create at
least one record before scheduling the process for object function to be invoked. For example,
create an Opportunity record before you schedule the process to invoke the UpdateOppty object
function. If there is no record, then the scheduler will fail and Scheduled Process page will show an
error in the status of the job.
4. The user who submitted the job in Scheduler will be stamped in the "Last Updated By" field of the
object. For use cases where you want to differentiate system updated records from end user
updated records, you can create an admin login, such as "system," that is designated for system
updates.
5. Values returned by the invoked object function are not reported through the ESS framework.
6. Functions of Child, Account, Contact and Partner objects cannot be scheduled for invocation.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 6 of 6

Você também pode gostar