Table of Contents

Search

  1. Preface
  2. Salesforce Managed Package
  3. Running a Guide within a Salesforce Organization
  4. Techniques
  5. Customizing Salesforce
  6. Mobile Guides
  7. Meeting Follow-up Wizards
  8. Controlling Who Sees Guides
  9. Launching a Guide
  10. Guide Execution Reports

Salesforce and Application Integration

Salesforce and Application Integration

Creating an Apex-based Service Call Step

Creating an Apex-based Service Call Step

You can create new Service Call step services using an Apex Class that implements the IAeAutomatedStepService
interface.

IAeAutomatedStepService Interface

To create the new services, you first implement two interface methods:
  • describe()
  • invoke()
describe()
Returns AeServiceDescription, which contains metadata for services.xml.
invoke()
Invoked at runtime.
For example:
global class icrtStep_EchoService implements IAeAutomatedStepService { global AeServiceDescription describe() { // called during synchronization } global AeServiceResponse invoke(AeServiceRequest aRequest) { // called at runtime } }

Service Discovery with Apex Automated Steps

When you synchronize your Salesforce organization, Apex services are discovered based on their class name. If a class name starts with "icrtStep", it is recognized as a Service step (an "Apex automated step"). For example, the Apex class named "icrtStep_EchoService" is a service.
Process objects or object lists are serialized to a JSON payload format, similar to the process object input or output in other processes. They are sent to Apex where the System.JSON class in Apex can parse the JSON.
To return a process object, define the outputs as either 'reference' or 'objectlist' and serialize the objects to JSON so Process Designer converts them back to a process object.
For example, for output parameters:
global AeServiceDescription.AeServiceParameterDesc output = sDescription.addOutputParameterDesc('objOutput', 'reference'); output.addParameterOption('referenceTo','Account');

Service Interface

Apex services must implement two methods:
  • describe()
  • invoke()
describe()
Provides information discovered for use by the cloud service.
Returns an instance of
AeServiceDescription
, which has the following fields:
Field
Description
serviceType
Type of service , either a service step or a search.
namespaceQualifier
Organization-specific namespace.
name
Service class name.
displayName
Name displayed to the user.
description
Text describing the service.
inputParameter (0..n)
List of input parameter descriptions.
(AeServiceDescription.AeParameterDesc)
outputParameter (0..n)
List of output parameter descriptions.
(AeServiceDescription.AeParameterDesc)
invoke()
Implements the runtime behavior of the service.
Parameter
Description
objectId
ID of the Applies To object from the host's context.
objectType
Type of the Applies To object from the host's context.
parameter (0..n)
List of AeServiceParameter name/value pairs.
Takes an instance of
AeServiceRequest
as input.
Returns
AeServiceResponse
, which has the following fields:
Field
Description
parameter (0..n)
List of AeServiceParameter name/value pairs.
errorInfo.AeErrorInfo
Conveys error information. Use this to relay error information instead of throwing an uncaught fault within your service
errorInfo.errorMessage
Error message.
errorInfo.invalidData
Field-level error details.

0 COMMENTS

We’d like to hear from you!