Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: salesforce update kamelet fix #1240

Merged
merged 1 commit into from
Jan 18, 2023
Merged
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
39 changes: 20 additions & 19 deletions kamelets/salesforce-update-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,21 @@ spec:
description: |-
Update an object in Salesforce.

The body received must contain a JSON key-value pair for each property to update, for example: `{ "Phone": "1234567890", "Name": "Antonia" }`
The body received must contain a JSON key-value pair for each property to update inside the payload attribute, for example:

The body received must include the `sObjectName` and `sObjectId` properties.
`{ "payload": { "Phone": "1234567890", "Name": "Antonia" } }`

The body received must include the `sObjectName` and `sObjectId` properties, for example:

`{ "payload": { "Phone": "1234567890", "Name": "Antonia" }, "sObjectId": "sObjectId", "sObjectName": "sObjectName" }`

required:
- sObjectName
- sObjectId
- clientId
- clientSecret
- userName
- password
type: object
properties:
sObjectName:
title: Object Name
description: The type of the Salesforce object. Required if using a key-value pair.
type: string
example: Contact
sObjectId:
title: Object Id
description: The ID of the Salesforce object. Required if using a key-value pair.
type: string
loginUrl:
title: Login URL
description: The Salesforce instance login URL.
Expand Down Expand Up @@ -91,6 +84,9 @@ spec:
in:
mediaType: application/json
dependencies:
- "camel:core"
- "camel:jsonpath"
- "camel:jackson"
- "camel:salesforce"
- "camel:kamelet"
template:
Expand All @@ -106,9 +102,14 @@ spec:
from:
uri: kamelet:source
steps:
- to:
uri: "{{local-salesforce}}:updateSObject"
parameters:
sObjectId: "{{sObjectId}}"
sObjectName: "{{sObjectName}}"
rawPayload: "true"
- set-property:
name: sObjectId
jsonpath: "$['sObjectId']"
- set-property:
name: sObjectName
jsonpath: "$['sObjectName']"
- transform:
jsonpath: "$['payload']"
- marshal:
json: {}
- toD: "{{local-salesforce}}:updateSObject?sObjectId=${exchangeProperty.sObjectId}&sObjectName=${exchangeProperty.sObjectName}&rawPayload=true"
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,21 @@ spec:
description: |-
Update an object in Salesforce.

The body received must contain a JSON key-value pair for each property to update, for example: `{ "Phone": "1234567890", "Name": "Antonia" }`
The body received must contain a JSON key-value pair for each property to update inside the payload attribute, for example:

The body received must include the `sObjectName` and `sObjectId` properties.
`{ "payload": { "Phone": "1234567890", "Name": "Antonia" } }`

The body received must include the `sObjectName` and `sObjectId` properties, for example:

`{ "payload": { "Phone": "1234567890", "Name": "Antonia" }, "sObjectId": "sObjectId", "sObjectName": "sObjectName" }`

required:
- sObjectName
- sObjectId
- clientId
- clientSecret
- userName
- password
type: object
properties:
sObjectName:
title: Object Name
description: The type of the Salesforce object. Required if using a key-value pair.
type: string
example: Contact
sObjectId:
title: Object Id
description: The ID of the Salesforce object. Required if using a key-value pair.
type: string
loginUrl:
title: Login URL
description: The Salesforce instance login URL.
Expand Down Expand Up @@ -91,6 +84,9 @@ spec:
in:
mediaType: application/json
dependencies:
- "camel:core"
- "camel:jsonpath"
- "camel:jackson"
- "camel:salesforce"
- "camel:kamelet"
template:
Expand All @@ -106,9 +102,14 @@ spec:
from:
uri: kamelet:source
steps:
- to:
uri: "{{local-salesforce}}:updateSObject"
parameters:
sObjectId: "{{sObjectId}}"
sObjectName: "{{sObjectName}}"
rawPayload: "true"
- set-property:
name: sObjectId
jsonpath: "$['sObjectId']"
- set-property:
name: sObjectName
jsonpath: "$['sObjectName']"
- transform:
jsonpath: "$['payload']"
- marshal:
json: {}
- toD: "{{local-salesforce}}:updateSObject?sObjectId=${exchangeProperty.sObjectId}&sObjectName=${exchangeProperty.sObjectName}&rawPayload=true"
8 changes: 5 additions & 3 deletions test/salesforce-sink/direct-to-salesforce-update-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ spec:
period: 60000
message: |-
{
"Phone": "1234567890"
"payload": {
"Phone": "1234567890"
},
"sObjectId": "Contact",
"sObjectName": "Contact"
}
sink:
ref:
Expand All @@ -41,5 +45,3 @@ spec:
clientSecret: "${client_secret}"
userName: "${userName}"
password: "${password}"
sObjectId: "${id}"
sObjectName: "Contact"