Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions AwsLambdaSample/Files/externalHooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Determinations via External hooks

External API hooks provide the option where customers can implement custom validations & determinations externally.

Please refer [here](https://pages.github.tools.sap/elsa/sap-n.docs/docs/architecture/extensibility/offngap/customlogic/customlogicexternalhooks/) for details on external hooks and how it can be configured.

We have implemented determination in our service.

### Determination Scenario:
If any user is changing the name of Lead, then we are determining and updating name accordingly as provided in AWS Lambda Function.

To achieve this, follow these steps:
* Create your IAM Root User in AWS console.
* Assuming user is created, login to AWS Console with valid user credentials.
* Create an AWS Lambda Function for performing determination using Lambda service provided in AWS console for a specific region. How to Configure Lambda function is provided [here](https://docs.aws.amazon.com/lambda/)
* Create an API using API Gateway Service provided in AWS console for a specific region same as that of Lambda’s. API can be of type HTTP or REST API. How to create API Gateway is provided [here](https://docs.aws.amazon.com/apigateway/?icmpid=docs_homepage_networking)
* Once API is created and determination/validation logic is written, create communication system in SAP Sales and Service Cloud
* Enter DisplayID.
* Choose outbound configuration.
* Give Host Name. Host Name is the API domain which you can get from URL of API created via AWS API Gateway. For example: https://www.sampleDomain.com.
* In authentication Method, enter “OAuth 2.0 Client Credentials”.
* Enter ClientID, Client Secret, Token URL. How to get these is explained in step- "OAuth 2.0 Client credentials setup".
* Save to see that communication system is activated.
* Once this is done, configure external hooks for entity. For this reference implementation, we need to enable for "Lead" entity. To enable, go to user menu->settings-> extensibility Administration-> Lead Service-> Lead. Under external hooks tab, create External hooks. Enter below details:
* Name
* Description
* Event - Pre Hook (since this is relevant for our determination scenario) / Post Hook (For Determination of extension fields or for Validations)
* API Path - relative path of API created via AWS API Gateway
* Communication system, which was created in previous step.

Refer below screenshot as well:
![Aws Lambda Extension](../Images/EH1.png "External Hooks")

### OAuth 2.0 Client credentials setup:

* Create Lambda function for authenticating OAuth credentials.
* Add that lambda function as Lambda Authorizer from AWS API Gateway -> Authorizers.



7 changes: 7 additions & 0 deletions AwsLambdaSample/Files/scenario.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Reference Scenario
### Scenario
Please find the details of reference scenario in this section.

As a sales executive when a lead is created in SAP sales and service cloud, if there is any requirement to determine a field value based on another field value OR default any standard field value OR determine a custom field value based on any field value entered in Lead, then extension to AWS Lambda Service can be used in SAP sales and service cloud.

**Determinations :** We have added determination in external service which is AWS Lambda Service via External hooks feature. Consider a Lead Name is maintained as “Lead low priority” and qualification as “Cold” while creating a Lead and when sales executive wants to change qualification to “Hot” so that name of the Lead can automatically set to “Lead high priority”. Determinations can be achieved by configuring external hook as prehook for standard field change and prehook/posthook for determinations on custom fields.
11 changes: 11 additions & 0 deletions AwsLambdaSample/Files/ssc_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Configurations in SAP Sales and Service Cloud
There are some configurations that needs to be done in SAP Sales and Service Cloud.
* Create a communication system in Admin Settings “Integration -> Communication Systems”. Please refer below screenshot. Here host name is the domain of API created in AWS API Gateway.

![Aws Lambda Extension](../Images/SSC1.png "Communication System")

* Create an External hook (prehook for determinations on standard/Extension fields or post hook for determination on extension fields/validations). This has to be created in Admin Settings “Extensibility -> Extensibility Administration -> Lead Service -> Lead(We are using lead our reference scenario). Here API Path is relative path in API created via API GATEWAY Service. Please refer below screenshot:

![Aws Lambda Extension](../Images/SSC2.png "External Hooks")

* In reference scenario, when Lead Name is maintained as “Lead low priority” and qualification as “Cold” while creating a Lead and when sales executive wants to change qualification to “Hot” so that name of the Lead can automatically set to “Lead high priority”.
Binary file added AwsLambdaSample/Images/EH1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AwsLambdaSample/Images/SSC1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AwsLambdaSample/Images/SSC2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions AwsLambdaSample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Leads Extensibility Scenario

## Description
This sample demonstrates side by side extension on Sales and Service Cloud for Leads Entity. Complete scenario details are mentioned in the section – [Reference Scenario](#reference-scenario).

We have created external service. Service is developed using Node.js in AWS Lambda Service and is interacting with SAP Sales and Service cloud via AWS API Gateway. Service is deployed in AWS.

## Key Features
The key extension features covered in this implementation are:
* External custom logic (validations/determinations) implementation using external hooks

## Prerequisites
For creating similar sample , below are the prerequisites along with link where you can learn more about them-
* Root User in AWS Management console. Helpful links for setup
https://aws.amazon.com/console/
* User in Sales and Service Cloud.

## Reference Scenario
Details of sample reference scenario is mentioned [here](./Files/scenario.md).

## Integrating external service
Please follow below mentioned steps to integrate external service and run leads application.
* [Sales and Sercice cloud configurations](./Files/ssc_configuration.md)
* [Aws Lambda Configuration and integration to SAP Sales and Service cloud using custom Logic external hooks](./Files/externalHooks.md)



2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Running various samples requires specific requirements which are mentioned in th

## Samples
[Vehicle Service Extension Sample](./VehicleServiceExtensionSample)

[Aws Lambda Sample](./AwsLambdaSample/)

## Known Issues
No knowns issues
Expand Down