From eb389075a7facd01fb51466725ea881e82c96f5e Mon Sep 17 00:00:00 2001 From: Cristian-Venticinque Date: Wed, 22 Apr 2026 15:05:51 -0300 Subject: [PATCH] Adding Salesforce connector example --- .../pages/_partials/acb-component-info.adoc | 110 +++++++++++++++++- .../pages/int-configure-components-add.adoc | 1 + 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/modules/ROOT/pages/_partials/acb-component-info.adoc b/modules/ROOT/pages/_partials/acb-component-info.adoc index 2a83c451c..6641a64ba 100644 --- a/modules/ROOT/pages/_partials/acb-component-info.adoc +++ b/modules/ROOT/pages/_partials/acb-component-info.adoc @@ -182,7 +182,7 @@ Includes On-Error Continue (``) and On-Error Propagate (` @@ -302,6 +304,104 @@ Your configuration XML file now looks similar to the following: ---- + +. Add another component to your flow. ++ +For example, add the *Create* operation from Anypoint Connector for Salesforce to insert an Account record. ++ +Use this pattern when your flow receives data through an HTTP Listener and must create Salesforce records. +If you completed the earlier steps that add *Set payload* with a fixed string, remove or replace that processor so you can shape the payload before *Create*. ++ +For more information about using *Create* with Account records, see xref:salesforce-connector::salesforce-connector-examples.adoc[]. ++ +.. In the configuration XML, add a global Salesforce connection element above your `` element (not inside the flow). ++ +Use configuration properties for credentials instead of literals; for example: ++ +[source,xml] +---- + + + +---- ++ +For more information about connection types and authentication fields, see xref:salesforce-connector::index.adoc[]. ++ +.. In the canvas, click the image:icon-plus.png["",15,15] (*Add component*) icon after *HTTP Listener*. +.. In the *Add Component* panel, search for *Set payload*, and add the component. +.. Configure *Set payload* with a DataWeave expression that builds a JSON object whose fields match your HTTP API (they need not match Salesforce field names yet). ++ +For example, use *fx* to enter DataWeave with `output application/json` and sample fields such as `companyName`, `industry`, and `phoneNumber`. ++ +Alternatively, add *Transform Message* and use the same DataWeave in ``. ++ +For more information about *Transform Message*, see xref:anypoint-code-builder::acb-component-transform.adoc[]. ++ +.. From the canvas, click the image:icon-plus.png["",15,15] (*Add component*) icon after *Set payload* (or *Transform Message*). +.. In the *Add Component* panel, click *Connectors*, select *Salesforce*, and select *Create*. +.. In the configuration panel for *Create*, set: ++ +-- +* *Connection config*: The global Salesforce configuration name (for example, `Salesforce_Config`). +* *Type*: `Account`. +* *Records*: A DataWeave expression that resolves to the records to create. ++ +If the incoming payload uses different property names than Salesforce expects, map those properties in *Records*, as shown in the configuration XML example that follows. +If the payload is already an array of Java objects with Salesforce field names (`output application/java`), you can use `#[payload]`. +-- ++ +[TIP] +==== +If *Type* stays empty until you establish a working Salesforce connection, set `type="Account"` on `` in the configuration XML. +For more information about connector fields for this operation, see xref:salesforce-connector::index.adoc[]. +==== ++ +[NOTE] +==== +Picklist fields such as *Industry* must use values that exist in your Salesforce organization. +==== ++ +The following configuration XML listens on `/accounts`, builds a JSON payload, maps it to Account fields inside ``, and calls *Create*. +Align `config-ref` on `` with the `name` of your `` (for example, `config-ref` from the earlier steps in this topic). ++ +[source,xml] +---- + + + + + + + + + + + + + #[%dw 2.0 +output application/java +--- +[{ + Name: payload.companyName, + Industry: payload.industry, + Phone: payload.phoneNumber +}]] + + + + +---- ++ +If the message payload is already an array of Java objects with Salesforce field names, you can omit `` and set *Records* to `#[payload]`, or use a self-closing `` element with that default. ++ +You can achieve the same result by adding *Transform Message* with `output application/java` followed by `` with *Records* set to `#[payload]`. // end::add-components[] // diff --git a/modules/ROOT/pages/int-configure-components-add.adoc b/modules/ROOT/pages/int-configure-components-add.adoc index 72887710b..fdf153bf4 100644 --- a/modules/ROOT/pages/int-configure-components-add.adoc +++ b/modules/ROOT/pages/int-configure-components-add.adoc @@ -1,5 +1,6 @@ = Adding a Component to Your Project :page-deployment-options: cloud-ide, desktop-ide +:open-config-xml: In the Explorer, open the configuration XML file for your project: include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"]