https://myXXXXXX.crm.ondemand.com/
.On the opened tab "All Communication Systems" click the "New" button from the top right. On the new form introduce all required information about the system including the ID of the system. In the current example, we gave the ID "US_SALES_MIDDLEWARE_DEMO". As value for the "Host Name" field should be the Kyma host URL(for instance: https://gateway.XXXXXX.kyma.shoot.live.k8s-hana.ondemand.com
)
Now you should be able to see the created arrangements on the list.
Keep adding as much as you consider the subscription for which you want to receive events.
After these steps on SAP Cloud Platform "System Landscape -> Systems", the registered system should be in the "Registered" state.
Details should look like this:
Details of created service:
Provision the Service Class in the selected (an example is using "default") Namespace, by clicking the "+ Add" button, and give a more friendly name.
module.exports = {
main: async function (event, context) {
console.log("SAP Sales Cloud(C4C) event: %s", JSON.stringify(event.data));
return 1;
}
}
After saving make sure that the final status is "Running".kubectl logs -f <name of function pod> function
{ "Changes": [ { "ChangedBy": "SAP_SYSTEM", "ChangedFields": [ { "Fieldname": "SystemAdministrativeData/LastChangeDateTime", "New": "2021-01-14T18:16:37.2393220Z", "Old": "2021-01-14T18:16:34.5940290Z" }, { "Fieldname": "VisitWorkItemGenerationCode", "New": "3", "Old": "1" }, { "Fieldname": "ChangeSource", "New": "JOB 20210114181637 ", "Old": "" } ], "Modification": "Updated", "ParentNodeID": "", "node": "Visit", "nodeID": "00163EAE7FFD1EEB95D282AD02F115EC" } ], "entity-id": "00163EAE7FFD1EEB95D282AD02F115EC", "root-entity-id": "00163EAE7FFD1EEB95D282AD02F115EC" }
CONFIGURATION={"credentials":{"password":"....","username":"...."},"csrfConfig":{"tokenUrl":"https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/"}}
CREDENTIALS_TYPE=basicauth
SAP_SALES_CLOUD_741C964E_854F_482E_A391_5A036C2403A9_GATEWAY_URL=http://default-gateway:8080/secret/c4c-sales-middleware-binding/api/SAP_SALES_CLOUD_741C964E_854F_482E_A391_5A036C2403A9
SAP_SALES_CLOUD_741C964E_854F_482E_A391_5A036C2403A9_TARGET_URL=https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/
"dependencies": {
"axios": "0.19.0"
}
const axios = require("axios");
const baseURL = `${process.env['SAP_SALES_CLOUD_***_GATEWAY_URL']}`; // this is where you need your GATEWAY_URL
module.exports = {
main: async function (event, context) {
// Get the accountId from the event payload
var visitId = event.data["entity-id"];
console.log(`Visist ID from Event: ${visitId}`);
try {
const json = JSON.parse(process.env.CONFIGURATION)
// read from C4C
var response = await axios({
method: 'get',
url: `${baseURL}/VisitCollection('${visitId}')`,
//params: {
// '$select': 'Field1,Field2'
//},
auth: {
username: json.credentials.username,
password: json.credentials.password
}
})
entity = response.data.d.results;
console.log("Visit Entity:")
console.log(entity);
} catch (error) {
console.log("Error:")
console.log(error);
event.extensions.response.status(500).send("Error");
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
25 | |
16 | |
14 | |
12 | |
10 | |
9 | |
9 | |
8 | |
8 | |
8 |