mulesoft-mcp-server 1.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -0
- package/dist/cjs/cli/assets/demo/data/data.csv +722 -0
- package/dist/cjs/cli/index.js +2 -0
- package/dist/esm/cli/assets/demo/data/data.csv +722 -0
- package/dist/esm/cli/index.js +2 -0
- package/package.json +105 -0
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
Prompt,Flow,Config,GAV
|
|
2
|
+
"Create a mule project with a flow that listens for HTTP requests at the ""/consumeImmediate"" path.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:http=""http://www.mulesoft.org/schema/mule/http"" xmlns:kafka=""http://www.mulesoft.org/schema/mule/kafka"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/kafka http://www.mulesoft.org/schema/mule/kafka/current/mule-kafka.xsd"">
|
|
3
|
+
|
|
4
|
+
<flow name=""consume-in-immediate-mode"" doc:id=""8c8ae245-e79c-4f46-a151-553c5b8d28ad"" >
|
|
5
|
+
<http:listener doc:name=""Listener"" doc:id=""58fe06bb-05f0-4968-af2c-a665af2763c1"" config-ref=""HTTP_Listener_config"" path=""/consumeImmediate""/>
|
|
6
|
+
</flow>
|
|
7
|
+
|
|
8
|
+
</mule>","<http:listener-config name=""HTTP_Listener_config"">
|
|
9
|
+
<http:listener-connection host=""0.0.0.0"" port=""8081""></http:listener-connection>
|
|
10
|
+
</http:listener-config>","<dependency>
|
|
11
|
+
<groupId>org.mule.connectors</groupId>
|
|
12
|
+
<artifactId>mule-http-connector</artifactId>
|
|
13
|
+
<version>1.10.3</version>
|
|
14
|
+
<classifier>mule-plugin</classifier>
|
|
15
|
+
</dependency>"
|
|
16
|
+
Add an operation to the flow to consume messages from a Kafka topic and then transforms the output to json.,"<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:http=""http://www.mulesoft.org/schema/mule/http"" xmlns:kafka=""http://www.mulesoft.org/schema/mule/kafka"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/kafka http://www.mulesoft.org/schema/mule/kafka/current/mule-kafka.xsd"">
|
|
17
|
+
|
|
18
|
+
<flow name=""consume-in-immediate-mode"" doc:id=""8c8ae245-e79c-4f46-a151-553c5b8d28ad"" >
|
|
19
|
+
<http:listener doc:name=""Listener"" doc:id=""58fe06bb-05f0-4968-af2c-a665af2763c1"" config-ref=""HTTP_Listener_config"" path=""/consumeImmediate""/>
|
|
20
|
+
<kafka:consume doc:name=""Consume"" doc:id=""4b97beff-db72-4866-9b12-b39a1f01c331"" config-ref=""Apache_Kafka_Consumer_configuration"" pollTimeout=""1000"" pollTimeoutTimeUnit=""SECONDS""/>
|
|
21
|
+
<ee:transform doc:name=""Transform Message"" doc:id=""c2422396-da03-4007-ab5a-82c9efbd3935"" >
|
|
22
|
+
<ee:message >
|
|
23
|
+
<ee:set-payload ><![CDATA[%dw 2.0
|
|
24
|
+
output application/json
|
|
25
|
+
---
|
|
26
|
+
payload]]></ee:set-payload>
|
|
27
|
+
</ee:message>
|
|
28
|
+
</ee:transform>
|
|
29
|
+
</flow> </mule>","<http:listener-config name=""HTTP_Listener_config"">
|
|
30
|
+
<http:listener-connection host=""0.0.0.0"" port=""8081""></http:listener-connection>
|
|
31
|
+
</http:listener-config>
|
|
32
|
+
<kafka:consumer-config name=""Kafka_Consumer_config"" doc:name=""Apache Kafka Consumer configuration"" doc:id=""b62404b7-017e-46bf-8003-8a94f94885a9"">
|
|
33
|
+
<kafka:consumer-plaintext-connection groupId=""grp"" topicPatterns=""blah-bean"">
|
|
34
|
+
<kafka:bootstrap-servers>
|
|
35
|
+
<kafka:bootstrap-server value=""test"" />
|
|
36
|
+
</kafka:bootstrap-servers>
|
|
37
|
+
</kafka:consumer-plaintext-connection>
|
|
38
|
+
</kafka:consumer-config>","<dependency>
|
|
39
|
+
<groupId>org.mule.connectors</groupId>
|
|
40
|
+
<artifactId>mule-http-connector</artifactId>
|
|
41
|
+
<version>1.10.3</version>
|
|
42
|
+
<classifier>mule-plugin</classifier>
|
|
43
|
+
</dependency>
|
|
44
|
+
<dependency>
|
|
45
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
46
|
+
<artifactId>mule-kafka-connector</artifactId>
|
|
47
|
+
<version>4.10.1</version>
|
|
48
|
+
<classifier>mule-plugin</classifier>
|
|
49
|
+
</dependency>"
|
|
50
|
+
"Generate a flow that tries to send a message to a JMS destination store under variable ""txDestination"".","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:jms=""http://www.mulesoft.org/schema/mule/jms"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd"">
|
|
51
|
+
|
|
52
|
+
<flow name=""nonTxPublishMustNotJoinCurrentTx"">
|
|
53
|
+
<try transactionalAction=""ALWAYS_BEGIN"">
|
|
54
|
+
<jms:publish config-ref=""config"" destination=""#[vars.txDestination]"" transactionalAction=""ALWAYS_JOIN""/>
|
|
55
|
+
</try>
|
|
56
|
+
</flow>
|
|
57
|
+
</mule>","<jms:config name=""config"">
|
|
58
|
+
<jms:active-mq-connection password=""pass"" clientId=""client-id"" username=""user""></jms:active-mq-connection>
|
|
59
|
+
</jms:config>","<dependency>
|
|
60
|
+
<groupId>org.mule.connectors</groupId>
|
|
61
|
+
<artifactId>mule-jms-connector</artifactId>
|
|
62
|
+
<version>1.10.1</version>
|
|
63
|
+
<classifier>mule-plugin</classifier>
|
|
64
|
+
</dependency>"
|
|
65
|
+
"Add an operation to the try scope that tries publish a message to a JMS destination stored under variable ""nonTxDestination"".","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:jms=""http://www.mulesoft.org/schema/mule/jms"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd"">
|
|
66
|
+
|
|
67
|
+
<flow name=""nonTxPublishMustNotJoinCurrentTx"">
|
|
68
|
+
<try transactionalAction=""ALWAYS_BEGIN"">
|
|
69
|
+
<jms:publish config-ref=""config"" destination=""#[vars.txDestination]"" transactionalAction=""ALWAYS_JOIN""/>
|
|
70
|
+
<jms:publish config-ref=""config"" destination=""#[vars.nonTxDestination]"" transactionalAction=""NOT_SUPPORTED""/>
|
|
71
|
+
</try>
|
|
72
|
+
</flow>
|
|
73
|
+
|
|
74
|
+
</mule>","<jms:config name=""config"">
|
|
75
|
+
<jms:active-mq-connection password=""pass"" clientId=""client-id"" username=""user""></jms:active-mq-connection>
|
|
76
|
+
</jms:config>","<dependency>
|
|
77
|
+
<groupId>org.mule.connectors</groupId>
|
|
78
|
+
<artifactId>mule-jms-connector</artifactId>
|
|
79
|
+
<version>1.10.1</version>
|
|
80
|
+
<classifier>mule-plugin</classifier>
|
|
81
|
+
</dependency>"
|
|
82
|
+
"Generate a flow that creates Contact objects in salesforce using variables firstName, lastName, Email, AccountId, and Phone.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:java=""http://www.mulesoft.org/schema/mule/java"" xmlns:jms=""http://www.mulesoft.org/schema/mule/jms"" xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/java http://www.mulesoft.org/schema/mule/java/current/mule-java.xsd"">
|
|
83
|
+
<flow name=""create_community_sfdccontact_flow"" doc:id=""540c17b0-01c6-46bb-be72-b8ca4ad70b69"">
|
|
84
|
+
<salesforce:create type=""Contact"" doc:name=""Create Customer Contact"" doc:id=""cb0a5f0e-cf35-4494-a623-54da386e945a"" config-ref=""Salesforce_Config"">
|
|
85
|
+
<salesforce:records ><![CDATA[#[[{
|
|
86
|
+
'FirstName': (if (isEmpty(vars.anypointUser.firstName)) (""Unknown"") else (vars.anypointUser.firstName[1 to 40] default vars.anypointUser.firstName)) default ""Unknown"",
|
|
87
|
+
'LastName': (if (isEmpty(vars.anypointUser.lastName)) (""Unknown"") else (vars.anypointUser.lastName[1 to 40] default vars.anypointUser.lastName)) default ""Unknown"",
|
|
88
|
+
'Email': vars.anypointUser.cleanemail,
|
|
89
|
+
'AccountId': vars.sfdcaccountid,
|
|
90
|
+
'Phone': vars.anypointUser.phoneNumber default '',
|
|
91
|
+
'Customer_Portal_User__c': true
|
|
92
|
+
}]]]]></salesforce:records>
|
|
93
|
+
</salesforce:create>
|
|
94
|
+
</flow> </mule>"," <salesforce:sfdc-config name=""sfdc_config"">
|
|
95
|
+
<salesforce:basic-connection securityToken=""tok"" password=""pass"" username=""user""></salesforce:basic-connection>
|
|
96
|
+
</salesforce:sfdc-config>","<dependency>
|
|
97
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
98
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
99
|
+
<version>10.22.8</version>
|
|
100
|
+
<classifier>mule-plugin</classifier>
|
|
101
|
+
</dependency>"
|
|
102
|
+
"Update the flow so that invokes a java method ""nextAccountID()"" and logs a message before creating the records in Salesforce.","<flow name=""create_community_sfdccontact_flow"" doc:id=""540c17b0-01c6-46bb-be72-b8ca4ad70b69"">
|
|
103
|
+
<java:invoke method=""nextAccountId()"" doc:name=""bucketAccounts.nextAccountId()"" doc:id=""691eac39-84a9-42c3-94b2-f89acb29ec03"" instance=""bucketAccounts"" class=""com.mulesoft.support.BucketAccounts"" target=""sfdcaccountid""/>
|
|
104
|
+
<logger level=""DEBUG"" doc:name=""Logger"" doc:id=""1ea7b38f-f8bb-46d6-ba9a-7da7995a7493"" message=""#['Create Community SFDC Contact for Account ID = ' ++ (vars.sfdcaccountid default 'null')]"" />
|
|
105
|
+
<salesforce:create type=""Contact"" doc:name=""Create Customer Contact"" doc:id=""cb0a5f0e-cf35-4494-a623-54da386e945a"" config-ref=""Salesforce_Config"">
|
|
106
|
+
<salesforce:records ><![CDATA[#[[{
|
|
107
|
+
'FirstName': (if (isEmpty(vars.anypointUser.firstName)) (""Unknown"") else (vars.anypointUser.firstName[1 to 40] default vars.anypointUser.firstName)) default ""Unknown"",
|
|
108
|
+
'LastName': (if (isEmpty(vars.anypointUser.lastName)) (""Unknown"") else (vars.anypointUser.lastName[1 to 40] default vars.anypointUser.lastName)) default ""Unknown"",
|
|
109
|
+
'Email': vars.anypointUser.cleanemail,
|
|
110
|
+
'AccountId': vars.sfdcaccountid,
|
|
111
|
+
'Phone': vars.anypointUser.phoneNumber default '',
|
|
112
|
+
'Customer_Portal_User__c': true
|
|
113
|
+
}]]]]></salesforce:records>
|
|
114
|
+
</salesforce:create>
|
|
115
|
+
</flow>"," <salesforce:sfdc-config name=""sfdc_config"">
|
|
116
|
+
<salesforce:basic-connection securityToken=""tok"" password=""pass"" username=""user""></salesforce:basic-connection>
|
|
117
|
+
</salesforce:sfdc-config>","<dependency>
|
|
118
|
+
<groupId>org.mule.modules</groupId>
|
|
119
|
+
<artifactId>mule-java-module</artifactId>
|
|
120
|
+
<version>1.2.13</version>
|
|
121
|
+
<classifier>mule-plugin</classifier>
|
|
122
|
+
</dependency>
|
|
123
|
+
|
|
124
|
+
<dependency>
|
|
125
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
126
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
127
|
+
<version>10.22.8</version>
|
|
128
|
+
<classifier>mule-plugin</classifier>
|
|
129
|
+
</dependency>"
|
|
130
|
+
"After creating the records, if the create operation is successful, store the id of the new Contact objects under variable ""sfdccontactid"". Otherwise, transform the payload into java and raise and error.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:java=""http://www.mulesoft.org/schema/mule/java"" xmlns:jms=""http://www.mulesoft.org/schema/mule/jms"" xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/java http://www.mulesoft.org/schema/mule/java/current/mule-java.xsd""> <flow name=""create_community_sfdccontact_flow"" doc:id=""540c17b0-01c6-46bb-be72-b8ca4ad70b69"">
|
|
131
|
+
<java:invoke method=""nextAccountId()"" doc:name=""bucketAccounts.nextAccountId()"" doc:id=""691eac39-84a9-42c3-94b2-f89acb29ec03"" instance=""bucketAccounts"" class=""com.mulesoft.support.BucketAccounts"" target=""sfdcaccountid""/>
|
|
132
|
+
<logger level=""DEBUG"" doc:name=""Logger"" doc:id=""1ea7b38f-f8bb-46d6-ba9a-7da7995a7493"" message=""#['Create Community SFDC Contact for Account ID = ' ++ (vars.sfdcaccountid default 'null')]"" />
|
|
133
|
+
<salesforce:create type=""Contact"" doc:name=""Create Customer Contact"" doc:id=""cb0a5f0e-cf35-4494-a623-54da386e945a"" config-ref=""Salesforce_Config"">
|
|
134
|
+
<salesforce:records ><![CDATA[#[[{
|
|
135
|
+
'FirstName': (if (isEmpty(vars.anypointUser.firstName)) (""Unknown"") else (vars.anypointUser.firstName[1 to 40] default vars.anypointUser.firstName)) default ""Unknown"",
|
|
136
|
+
'LastName': (if (isEmpty(vars.anypointUser.lastName)) (""Unknown"") else (vars.anypointUser.lastName[1 to 40] default vars.anypointUser.lastName)) default ""Unknown"",
|
|
137
|
+
'Email': vars.anypointUser.cleanemail,
|
|
138
|
+
'AccountId': vars.sfdcaccountid,
|
|
139
|
+
'Phone': vars.anypointUser.phoneNumber default '',
|
|
140
|
+
'Customer_Portal_User__c': true
|
|
141
|
+
}]]]]></salesforce:records>
|
|
142
|
+
</salesforce:create>
|
|
143
|
+
<choice doc:name=""Choice"" doc:id=""31b45eda-11d2-4eea-98f4-e1e01937b8c2"">
|
|
144
|
+
<when expression=""#[payload.successful]"">
|
|
145
|
+
<set-variable value=""#[payload.items[0].id]"" doc:name=""sfdccontactid"" doc:id=""70e02658-35cc-4fc3-9925-0d2d7e941844"" variableName=""sfdccontactid""/>
|
|
146
|
+
<set-payload value=""#['']"" doc:name=""clear""/>
|
|
147
|
+
</when>
|
|
148
|
+
<otherwise >
|
|
149
|
+
<ee:transform doc:name=""Error description"" doc:id=""43c4696f-2b3c-4ce4-bdd0-656dae28734d"">
|
|
150
|
+
<ee:message>
|
|
151
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
152
|
+
output application/java
|
|
153
|
+
import java!com::mulesoft::support::LoginHelper
|
|
154
|
+
---
|
|
155
|
+
'Failure creating community contact for SFDC account ID ' ++ (vars.sfdcaccountid default 'null') ++ '.\n' ++ (vars.auserstring default '') ++ '\n' ++ LoginHelper::getBulkOperationResultException(payload)]]></ee:set-payload>
|
|
156
|
+
</ee:message>
|
|
157
|
+
</ee:transform>
|
|
158
|
+
<raise-error doc:name=""SFDCERROR:CREATECONTACT"" doc:id=""0260592d-337a-4b6e-98b0-a259073eb2fe"" type=""SFDCERROR:CREATECONTACT"" description=""#[payload]""/>
|
|
159
|
+
</otherwise>
|
|
160
|
+
</choice>
|
|
161
|
+
</flow> <mule>"," <salesforce:sfdc-config name=""sfdc_config"">
|
|
162
|
+
<salesforce:basic-connection securityToken=""tok"" password=""pass"" username=""user""></salesforce:basic-connection>
|
|
163
|
+
</salesforce:sfdc-config>","<dependency>
|
|
164
|
+
<groupId>org.mule.modules</groupId>
|
|
165
|
+
<artifactId>mule-java-module</artifactId>
|
|
166
|
+
<version>1.2.13</version>
|
|
167
|
+
<classifier>mule-plugin</classifier>
|
|
168
|
+
</dependency>
|
|
169
|
+
<dependency>
|
|
170
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
171
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
172
|
+
<version>10.22.8</version>
|
|
173
|
+
<classifier>mule-plugin</classifier>
|
|
174
|
+
</dependency>"
|
|
175
|
+
"Create a mule project and generate a flow that queries Opportunity objects from Salesforce where the Id is equal to query parameter ""id"". ","
|
|
176
|
+
<?xml version=""1.0"" encoding=""UTF-8""?>
|
|
177
|
+
<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
|
|
178
|
+
http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd
|
|
179
|
+
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"">
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<flow name=""do-get-se-details"" doc:id=""d42cd5e5-3d6b-4403-a1ee-993468790832"" >
|
|
183
|
+
<salesforce:query doc:name=""Query Get SE Details of Opportunity"" doc:id=""3c340c9a-bbfb-4689-8747-f8c18e050893"" config-ref=""Salesforce_Config"">
|
|
184
|
+
<salesforce:salesforce-query><![CDATA[SELECT Tech_Sales_Stage__c, Evaluation_Type__c, Evaluation_Plan_link__c,
|
|
185
|
+
Pre_Sales_Anypoint_CSID__c, SC_Manager_Notes__c, SE_Add_On_Type__c
|
|
186
|
+
FROM Opportunity
|
|
187
|
+
WHERE Id = ':id']]></salesforce:salesforce-query>
|
|
188
|
+
<salesforce:parameters><![CDATA[#[output application/java
|
|
189
|
+
---
|
|
190
|
+
{
|
|
191
|
+
""id"" : vars.opportunity_id
|
|
192
|
+
}]]]></salesforce:parameters>
|
|
193
|
+
</salesforce:query>
|
|
194
|
+
</flow>
|
|
195
|
+
</mule>"," <salesforce:sfdc-config name=""Salesforce_Config"">
|
|
196
|
+
<salesforce:basic-connection securityToken=""tok"" password=""pass"" username=""user""></salesforce:basic-connection>
|
|
197
|
+
</salesforce:sfdc-config>","
|
|
198
|
+
<dependency>
|
|
199
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
200
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
201
|
+
<version>10.22.8</version>
|
|
202
|
+
<classifier>mule-plugin</classifier>
|
|
203
|
+
</dependency>"
|
|
204
|
+
" Now, transform the payload into a JSON format.","<?xml version=""1.0"" encoding=""UTF-8""?>
|
|
205
|
+
<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
|
|
206
|
+
http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd
|
|
207
|
+
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"">
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
<flow name=""do-get-se-details"" doc:id=""d42cd5e5-3d6b-4403-a1ee-993468790832"" >
|
|
211
|
+
<salesforce:query doc:name=""Query Get SE Details of Opportunity"" doc:id=""3c340c9a-bbfb-4689-8747-f8c18e050893"" config-ref=""Salesforce_Config"">
|
|
212
|
+
<salesforce:salesforce-query><![CDATA[SELECT Tech_Sales_Stage__c, Evaluation_Type__c, Evaluation_Plan_link__c,
|
|
213
|
+
Pre_Sales_Anypoint_CSID__c, SC_Manager_Notes__c, SE_Add_On_Type__c
|
|
214
|
+
FROM Opportunity
|
|
215
|
+
WHERE Id = ':id']]></salesforce:salesforce-query>
|
|
216
|
+
<salesforce:parameters><![CDATA[#[output application/java
|
|
217
|
+
---
|
|
218
|
+
{
|
|
219
|
+
""id"" : vars.opportunity_id
|
|
220
|
+
}]]]></salesforce:parameters>
|
|
221
|
+
</salesforce:query>
|
|
222
|
+
<ee:transform doc:name=""Transform Message"" doc:id=""b8cfaf91-2546-4230-a004-34b3c65f2b6c"">
|
|
223
|
+
<ee:message>
|
|
224
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
225
|
+
output application/json
|
|
226
|
+
---
|
|
227
|
+
{
|
|
228
|
+
technical_sales_stage: payload[0].Tech_Sales_Stage__c,
|
|
229
|
+
evaluation_type: payload[0].Evaluation_Type__c,
|
|
230
|
+
evaluation_plan_link: payload[0].Evaluation_Plan_link__c,
|
|
231
|
+
manager_notes: payload[0].SC_Manager_Notes__c,
|
|
232
|
+
addon_type: payload[0].SE_Add_On_Type__c
|
|
233
|
+
}]]></ee:set-payload>
|
|
234
|
+
</ee:message>
|
|
235
|
+
</ee:transform>
|
|
236
|
+
</flow>
|
|
237
|
+
|
|
238
|
+
</mule>
|
|
239
|
+
"," <salesforce:sfdc-config name=""Salesforce_Config"">
|
|
240
|
+
<salesforce:basic-connection securityToken=""tok"" password=""pass"" username=""user""></salesforce:basic-connection>
|
|
241
|
+
</salesforce:sfdc-config>","
|
|
242
|
+
<dependency>
|
|
243
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
244
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
245
|
+
<version>10.22.8</version>
|
|
246
|
+
<classifier>mule-plugin</classifier>
|
|
247
|
+
</dependency>"
|
|
248
|
+
Generate a flow that triggers to run every minute.,"<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd >
|
|
249
|
+
|
|
250
|
+
<flow name=""dw-streaming-jsonFlow"" >
|
|
251
|
+
<scheduler doc:name=""Scheduler"" >
|
|
252
|
+
<scheduling-strategy >
|
|
253
|
+
<fixed-frequency frequency=""1"" timeUnit=""MINUTES""/>
|
|
254
|
+
</scheduling-strategy>
|
|
255
|
+
</scheduler>
|
|
256
|
+
</flow>
|
|
257
|
+
</mule>",,
|
|
258
|
+
"Add an operation to read a JSON file from path ""${app.home}/myjsonarray.json"".","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:file=""http://www.mulesoft.org/schema/mule/file"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd"">
|
|
259
|
+
|
|
260
|
+
<flow name=""dw-streaming-jsonFlow"" >
|
|
261
|
+
<scheduler doc:name=""Scheduler"" >
|
|
262
|
+
<scheduling-strategy >
|
|
263
|
+
<fixed-frequency frequency=""1"" timeUnit=""MINUTES""/>
|
|
264
|
+
</scheduling-strategy>
|
|
265
|
+
</scheduler>
|
|
266
|
+
<file:read doc:name=""Read""
|
|
267
|
+
config-ref=""File_Config""
|
|
268
|
+
path=""${app.home}/myjsonarray.json""
|
|
269
|
+
outputMimeType=""application/json; streaming=true""/>
|
|
270
|
+
</flow>
|
|
271
|
+
</mule>"," <file:config name=""File_Config1"">
|
|
272
|
+
<file:connection></file:connection>
|
|
273
|
+
</file:config>","<dependency>
|
|
274
|
+
<groupId>org.mule.connectors</groupId>
|
|
275
|
+
<artifactId>mule-file-connector</artifactId>
|
|
276
|
+
<version>1.5.2</version>
|
|
277
|
+
<classifier>mule-plugin</classifier>
|
|
278
|
+
</dependency>"
|
|
279
|
+
"After, transform the output of the file to map the ""zipcode"" from each element in the JSON file.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:file=""http://www.mulesoft.org/schema/mule/file"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd"">
|
|
280
|
+
|
|
281
|
+
<flow name=""dw-streaming-jsonFlow"" >
|
|
282
|
+
<scheduler doc:name=""Scheduler"" >
|
|
283
|
+
<scheduling-strategy >
|
|
284
|
+
<fixed-frequency frequency=""1"" timeUnit=""MINUTES""/>
|
|
285
|
+
</scheduling-strategy>
|
|
286
|
+
</scheduler>
|
|
287
|
+
<file:read doc:name=""Read""
|
|
288
|
+
config-ref=""File_Config""
|
|
289
|
+
path=""${app.home}/myjsonarray.json""
|
|
290
|
+
outputMimeType=""application/json; streaming=true""/>
|
|
291
|
+
<ee:transform doc:name=""Transform Message"" >
|
|
292
|
+
<ee:message >
|
|
293
|
+
<ee:set-payload ><![CDATA[%dw 2.0
|
|
294
|
+
output application/json
|
|
295
|
+
---
|
|
296
|
+
payload.myJsonExample map ((element) -> {
|
|
297
|
+
returnedElement : element.zipcode
|
|
298
|
+
})]]></ee:set-payload>
|
|
299
|
+
</ee:message>
|
|
300
|
+
</ee:transform>
|
|
301
|
+
</flow> </mule>"," <file:config name=""File_Config1"">
|
|
302
|
+
<file:connection></file:connection>
|
|
303
|
+
</file:config>","<dependency>
|
|
304
|
+
<groupId>org.mule.connectors</groupId>
|
|
305
|
+
<artifactId>mule-file-connector</artifactId>
|
|
306
|
+
<version>1.5.2</version>
|
|
307
|
+
<classifier>mule-plugin</classifier>
|
|
308
|
+
</dependency>"
|
|
309
|
+
" Lastly, write the transformed output to another file and log the payload.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:file=""http://www.mulesoft.org/schema/mule/file"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd"">
|
|
310
|
+
|
|
311
|
+
<flow name=""dw-streaming-jsonFlow"" >
|
|
312
|
+
<scheduler doc:name=""Scheduler"" >
|
|
313
|
+
<scheduling-strategy >
|
|
314
|
+
<fixed-frequency frequency=""1"" timeUnit=""MINUTES""/>
|
|
315
|
+
</scheduling-strategy>
|
|
316
|
+
</scheduler>
|
|
317
|
+
<file:read doc:name=""Read""
|
|
318
|
+
config-ref=""File_Config""
|
|
319
|
+
path=""${app.home}/myjsonarray.json""
|
|
320
|
+
outputMimeType=""application/json; streaming=true""/>
|
|
321
|
+
<ee:transform doc:name=""Transform Message"" >
|
|
322
|
+
<ee:message >
|
|
323
|
+
<ee:set-payload ><![CDATA[%dw 2.0
|
|
324
|
+
output application/json
|
|
325
|
+
---
|
|
326
|
+
payload.myJsonExample map ((element) -> {
|
|
327
|
+
returnedElement : element.zipcode
|
|
328
|
+
})]]></ee:set-payload>
|
|
329
|
+
</ee:message>
|
|
330
|
+
</ee:transform>
|
|
331
|
+
</flow> </mule>"," <file:config name=""File_Config1"">
|
|
332
|
+
<file:connection></file:connection>
|
|
333
|
+
</file:config>","<dependency>
|
|
334
|
+
<groupId>org.mule.connectors</groupId>
|
|
335
|
+
<artifactId>mule-file-connector</artifactId>
|
|
336
|
+
<version>1.5.2</version>
|
|
337
|
+
<classifier>mule-plugin</classifier>
|
|
338
|
+
</dependency>"
|
|
339
|
+
Generate a flow that retrieves user data from a database.,"<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:db=""http://www.mulesoft.org/schema/mule/db"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:scripting=""http://www.mulesoft.org/schema/mule/scripting"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd"">
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
<flow>
|
|
343
|
+
<db:select config-ref=""dbConfig"" doc:name=""getUser"">
|
|
344
|
+
<db:sql>${sfdl.dbqueries.getUser}</db:sql>
|
|
345
|
+
<db:input-parameters>
|
|
346
|
+
#[{'user' : vars.user,
|
|
347
|
+
'formatDate':'%Y-%m-%dT%TZ'}]
|
|
348
|
+
</db:input-parameters>
|
|
349
|
+
</db:select>
|
|
350
|
+
</flow>
|
|
351
|
+
</mule>
|
|
352
|
+
","<db:config name=""Config"">
|
|
353
|
+
<db:my-sql-connection password=""password"" database=""db"" port=""3306"" host=""localhost"" user=""user""></db:my-sql-connection>
|
|
354
|
+
</db:config>","<dependency>
|
|
355
|
+
<groupId>org.mule.connectors</groupId>
|
|
356
|
+
<artifactId>mule-db-connector</artifactId>
|
|
357
|
+
<version>1.14.13</version>
|
|
358
|
+
<classifier>mule-plugin</classifier>
|
|
359
|
+
</dependency>"
|
|
360
|
+
"When the no results come back from the database, execute a script that throws an exception saying that ""The resource was not found"". Otherwise, transform the results into json format.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:db=""http://www.mulesoft.org/schema/mule/db"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:scripting=""http://www.mulesoft.org/schema/mule/scripting"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd"">
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
<flow>
|
|
364
|
+
<db:select config-ref=""dbConfig"" doc:name=""getUser"">
|
|
365
|
+
<db:sql>${sfdl.dbqueries.getUser}</db:sql>
|
|
366
|
+
<db:input-parameters>
|
|
367
|
+
#[{'user' : vars.user,
|
|
368
|
+
'formatDate':'%Y-%m-%dT%TZ'}]
|
|
369
|
+
</db:input-parameters>
|
|
370
|
+
</db:select>
|
|
371
|
+
|
|
372
|
+
<choice>
|
|
373
|
+
<when expression=""#[isEmpty(payload)]"">
|
|
374
|
+
<scripting:execute engine=""groovy"">
|
|
375
|
+
<scripting:code><![CDATA[
|
|
376
|
+
throw new com.mule.sfdl.console.exception.NotFoundException(""The resource was not found"")
|
|
377
|
+
]]></scripting:code>
|
|
378
|
+
</scripting:execute>
|
|
379
|
+
</when>
|
|
380
|
+
<otherwise>
|
|
381
|
+
<ee:transform doc:name=""Object to JSON"">
|
|
382
|
+
<ee:message>
|
|
383
|
+
<ee:set-payload>
|
|
384
|
+
%dw 2.0
|
|
385
|
+
output application/json
|
|
386
|
+
---
|
|
387
|
+
payload
|
|
388
|
+
</ee:set-payload>
|
|
389
|
+
</ee:message>
|
|
390
|
+
</ee:transform>
|
|
391
|
+
</otherwise>
|
|
392
|
+
</choice>
|
|
393
|
+
</flow> </mule>","<db:config name=""Config"">
|
|
394
|
+
<db:my-sql-connection password=""password"" database=""db"" port=""3306"" host=""localhost"" user=""user""></db:my-sql-connection>
|
|
395
|
+
</db:config>","<dependency>
|
|
396
|
+
<groupId>org.mule.connectors</groupId>
|
|
397
|
+
<artifactId>mule-db-connector</artifactId>
|
|
398
|
+
<version>1.14.13</version>
|
|
399
|
+
<classifier>mule-plugin</classifier>
|
|
400
|
+
</dependency>
|
|
401
|
+
<dependency>
|
|
402
|
+
<groupId>org.mule.modules</groupId>
|
|
403
|
+
<artifactId>mule-scripting-module</artifactId>
|
|
404
|
+
<version>2.1.1</version>
|
|
405
|
+
<classifier>mule-plugin</classifier>
|
|
406
|
+
</dependency>"
|
|
407
|
+
"Generate a flow that listens for a request to delete a sales order in NetSuite based on the provided order ID. If the order is successfully deleted, it returns a JSON response with the status and order ID. If the order is not found, it returns a JSON response indicating that the record was not found.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:http=""http://www.mulesoft.org/schema/mule/http"" xmlns:netsuite=""http://www.mulesoft.org/schema/mule/netsuite"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd"">
|
|
408
|
+
|
|
409
|
+
<flow name=""delete-sales-order-flow"">
|
|
410
|
+
<http:listener config-ref=""Listener-config"" doc:id=""e8c1d1a0-0c9e-4c1b-8c5e-4b0a4c0f1f5b"" doc:name=""Listener"" path=""/deleteSalesOrder""></http:listener>
|
|
411
|
+
<ee:transform doc:id=""b9b9b6b2-9b5b-4b9d-9b3d-6a1f4f7e8a1d"" doc:name=""Transform Message"">
|
|
412
|
+
<ee:message>
|
|
413
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
414
|
+
output application/json
|
|
415
|
+
---
|
|
416
|
+
{
|
|
417
|
+
orderID: attributes.queryParams.orderID
|
|
418
|
+
}]]></ee:set-payload>
|
|
419
|
+
</ee:message>
|
|
420
|
+
</ee:transform>
|
|
421
|
+
<netsuite:delete config-ref=""Netsuite_config"" doc:id=""b6e4c6c7-9b5b-4b9d-9b3d-6a1f4f7e8a1d"" doc:name=""Delete Sales Order""></netsuite:delete>
|
|
422
|
+
<choice doc:id=""b6e4c6c7-9b5b-4b9d-9b3d-6a1f4f3e8a1d"" doc:name=""Choice"">
|
|
423
|
+
<when expression=""#[vars.statusCode == 200]"">
|
|
424
|
+
<ee:transform doc:id=""b9b9b6b2-9b5b-4b9d-9b3e-6a1f4f7e8a1d"" doc:name=""Transform Success Response"">
|
|
425
|
+
<ee:message>
|
|
426
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
427
|
+
output application/json
|
|
428
|
+
---
|
|
429
|
+
{
|
|
430
|
+
status: ""Order successfully deleted"",
|
|
431
|
+
orderID: attributes.queryParams.orderID
|
|
432
|
+
}]]></ee:set-payload>
|
|
433
|
+
</ee:message>
|
|
434
|
+
</ee:transform>
|
|
435
|
+
</when>
|
|
436
|
+
<otherwise>
|
|
437
|
+
<ee:transform doc:id=""b9b9b6b2-9b5b-4b9d-9b38-6a1f4f7e8a1d"" doc:name=""Transform Error Response"">
|
|
438
|
+
<ee:message>
|
|
439
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
440
|
+
output application/json
|
|
441
|
+
---
|
|
442
|
+
{
|
|
443
|
+
status: ""Order not found"",
|
|
444
|
+
orderID: attributes.queryParams.orderID
|
|
445
|
+
}]]></ee:set-payload>
|
|
446
|
+
</ee:message>
|
|
447
|
+
</ee:transform>
|
|
448
|
+
</otherwise>
|
|
449
|
+
</choice>
|
|
450
|
+
</flow>
|
|
451
|
+
</mule>
|
|
452
|
+
","<netsuite:config name=""Netsuite_config"">
|
|
453
|
+
<netsuite:token-based-authentication-connection account=""1234"" consumerKey=""Test"" consumerSecret=""Test"" tokenId=""tokenID"" tokenSecret=""token Secret""></netsuite:token-based-authentication-connection>
|
|
454
|
+
</netsuite:config>
|
|
455
|
+
<http:listener-config name=""Listener-config"">
|
|
456
|
+
<http:listener-connection port=""8081"" host=""0.0.0.0""></http:listener-connection>
|
|
457
|
+
</http:listener-config>","<dependency>
|
|
458
|
+
<groupId>org.mule.connectors</groupId>
|
|
459
|
+
<artifactId>mule-http-connector</artifactId>
|
|
460
|
+
<version>1.10.3</version>
|
|
461
|
+
<classifier>mule-plugin</classifier>
|
|
462
|
+
</dependency>
|
|
463
|
+
<dependency>
|
|
464
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
465
|
+
<artifactId>mule-netsuite-connector</artifactId>
|
|
466
|
+
<version>11.10.0</version>
|
|
467
|
+
<classifier>mule-plugin</classifier>
|
|
468
|
+
</dependency>"
|
|
469
|
+
"Create a mule project that listens for HTTP requests at the ""/put-time-clock-events"" path, logs the request, transforms the message payload into a specific XML format, sends the transformed payload to Workday time tracking service, and then transforms the response into JSON format before logging the final output.","<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:workday=""http://www.mulesoft.org/schema/mule/workday"" xmlns:http=""http://www.mulesoft.org/schema/mule/http"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
|
|
470
|
+
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
|
|
471
|
+
http://www.mulesoft.org/schema/mule/workday http://www.mulesoft.org/schema/mule/workday/current/mule-workday.xsd
|
|
472
|
+
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"">
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
<flow name=""put-time-clock-events"">
|
|
476
|
+
<http:listener path=""/put-time-clock-events"" config-ref=""HTTP_Listener_config"" />
|
|
477
|
+
<logger level=""INFO"" message=""Received HTTP request"" />
|
|
478
|
+
<ee:transform>
|
|
479
|
+
<ee:message>
|
|
480
|
+
<ee:set-payload>
|
|
481
|
+
<![CDATA[%dw 2.0
|
|
482
|
+
output application/xml
|
|
483
|
+
---
|
|
484
|
+
{
|
|
485
|
+
// Transform the message payload into the specific XML format
|
|
486
|
+
}]]>
|
|
487
|
+
</ee:set-payload>
|
|
488
|
+
</ee:message>
|
|
489
|
+
</ee:transform>
|
|
490
|
+
<workday:time-tracking operation=""Time_Tracking_Operation"" config-ref=""Workday_Config"" />
|
|
491
|
+
<ee:transform>
|
|
492
|
+
<ee:message>
|
|
493
|
+
<ee:set-payload>
|
|
494
|
+
<![CDATA[%dw 2.0
|
|
495
|
+
output application/json
|
|
496
|
+
---
|
|
497
|
+
{
|
|
498
|
+
// Transform the response into JSON format
|
|
499
|
+
}]]>
|
|
500
|
+
</ee:set-payload>
|
|
501
|
+
</ee:message>
|
|
502
|
+
</ee:transform>
|
|
503
|
+
<logger level=""INFO"" message=""Final output: #[payload]"" />
|
|
504
|
+
</flow>
|
|
505
|
+
</mule>","<workday:config name=""Config"">
|
|
506
|
+
<workday:basic-authentication-api-connection password=""Pass"" tenantName=""acme"" userName=""Test""></workday:basic-authentication-api-connection>
|
|
507
|
+
</workday:config>","<dependency>
|
|
508
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
509
|
+
<artifactId>mule-workday-connector</artifactId>
|
|
510
|
+
<version>16.2.2</version>
|
|
511
|
+
<classifier>mule-plugin</classifier>
|
|
512
|
+
</dependency>"
|
|
513
|
+
"Create a mule project with a flow that listens for new objects in an Amazon S3 bucket. When a new object (CSV file) is detected, it retrieves the file, transforms the CSV data into JSON, removes IsDeleted and Id fields, upserts the data into Salesforce, logs the payload, and finally deletes the CSV file from the S3 bucket.","<?xml version=""1.0"" encoding=""UTF-8""?>
|
|
514
|
+
<mule xmlns=""http://www.mulesoft.org/schema/mule/core"" xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core"" xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce"" xmlns:s3=""http://www.mulesoft.org/schema/mule/s3"" xsi:schemaLocation=""http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
|
|
515
|
+
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
|
|
516
|
+
http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd
|
|
517
|
+
http://www.mulesoft.org/schema/mule/s3 http://www.mulesoft.org/schema/mule/s3/current/mule-s3.xsd"">
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
<flow name=""s3_to_salesforce_integration"" doc:id=""a1b2c3d4-e5f6-7g8h-9i0j"">
|
|
521
|
+
<s3:new-object-listener doc:name=""Delete CSV File"" doc:id=""b1c2d3e4-f5g6-h7i8-j9k0"" config-ref=""Amazon_S3_Configuration"" bucketName=""bucket-name"" >
|
|
522
|
+
<scheduling-strategy>
|
|
523
|
+
<fixed-frequency />
|
|
524
|
+
</scheduling-strategy>
|
|
525
|
+
</s3:new-object-listener>
|
|
526
|
+
<set-variable value=""#[payload]"" doc:name=""Save CSV Data"" doc:id=""c1d2e3f4-g5h6-i7j8-k9l0"" variableName=""csvData"" />
|
|
527
|
+
<ee:transform doc:name=""Convert CSV to JSON"" doc:id=""d1e2f3g4-h5i6-j7k8-l9m0"">
|
|
528
|
+
<ee:message>
|
|
529
|
+
<ee:set-payload>
|
|
530
|
+
<![CDATA[%dw 2.0
|
|
531
|
+
output application/json
|
|
532
|
+
---
|
|
533
|
+
payload map ((value, index) ->
|
|
534
|
+
value - ""IsDeleted"" - ""Id""
|
|
535
|
+
)]]>
|
|
536
|
+
</ee:set-payload>
|
|
537
|
+
</ee:message>
|
|
538
|
+
</ee:transform>
|
|
539
|
+
<salesforce:upsert doc:name=""Upsert to Salesforce"" doc:id=""e1f2g3h4-i5j6-k7l8-m9n0"" config-ref=""Salesforce_Config"" externalIdFieldName=""ExternalId"" objectType=""CustomObject"" />
|
|
540
|
+
<logger level=""INFO"" doc:name=""Log Payload"" doc:id=""f1g2h3i4-j5k6-l7m8-n9o0"" message=""#[payload]"" />
|
|
541
|
+
<s3:delete-object doc:name=""Delete CSV File"" doc:id=""g1h2i3j4-k5l6-m7n8-o9p0"" config-ref=""Amazon_S3_Configuration"" bucketName=""bucket-name"" key=""object-key""/>
|
|
542
|
+
</flow>
|
|
543
|
+
</mule>"," <s3:config name=""S3_Config"">
|
|
544
|
+
<s3:connection secretKey=""test"" accessKey=""test""></s3:connection>
|
|
545
|
+
</s3:config>
|
|
546
|
+
|
|
547
|
+
<salesforce:sfdc-config name=""Sfdc-config"">
|
|
548
|
+
<salesforce:basic-connection securityToken=""test"" password=""Welcome1"" username=""Test""></salesforce:basic-connection>
|
|
549
|
+
</salesforce:sfdc-config>","<dependency>
|
|
550
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
551
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
552
|
+
<version>10.22.8</version>
|
|
553
|
+
<classifier>mule-plugin</classifier>
|
|
554
|
+
</dependency>
|
|
555
|
+
<dependency>
|
|
556
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
557
|
+
<artifactId>mule-amazon-s3-connector</artifactId>
|
|
558
|
+
<version>7.0.6</version>
|
|
559
|
+
<classifier>mule-plugin</classifier>
|
|
560
|
+
</dependency>"
|
|
561
|
+
Create a Mule project that creates an order in NetSuite every time an Opportunity in Salesforce is updated to stage Closed Won.,"<?xml version=""1.0"" encoding=""UTF-8""?>
|
|
562
|
+
<mule xmlns=""http://www.mulesoft.org/schema/mule/core""
|
|
563
|
+
xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce""
|
|
564
|
+
xmlns:netsuite=""http://www.mulesoft.org/schema/mule/netsuite""
|
|
565
|
+
xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core""
|
|
566
|
+
xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation""
|
|
567
|
+
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
|
|
568
|
+
xsi:schemaLocation=""
|
|
569
|
+
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
|
|
570
|
+
http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd
|
|
571
|
+
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
|
|
572
|
+
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"">
|
|
573
|
+
|
|
574
|
+
<flow name=""opportunity-to-order"" doc:id=""d1e2f3a4-b567-4c8d-90e5-123456789abc"">
|
|
575
|
+
<salesforce:modified-object-listener doc:name=""On Modified Opportunity"" doc:id=""abc12345-def6-7890-gh12-ijkl345678mn"" config-ref=""Salesforce_Config"" objectType=""Opportunity"">
|
|
576
|
+
<scheduling-strategy>
|
|
577
|
+
<fixed-frequency frequency=""1"" timeUnit=""MINUTES""/>
|
|
578
|
+
</scheduling-strategy>
|
|
579
|
+
</salesforce:modified-object-listener>
|
|
580
|
+
<choice doc:name=""Check Opportunity Stage"" doc:id=""choice1234-5678-90ab-cdef-ghijklmnopqr"">
|
|
581
|
+
<when expression='#[payload.StageName == ""Closed Won""]'>
|
|
582
|
+
<logger level=""INFO"" doc:name=""Log Closed Won Opportunity"" doc:id=""logger-before-transform"" message=""Processing Closed Won opportunity: #[payload.Id] - #[payload.Name]""/>
|
|
583
|
+
<ee:transform doc:name=""Prepare NetSuite Order"" doc:id=""transform1234-5678-90ab-cdef-ghijklmnopqr"">
|
|
584
|
+
<ee:message>
|
|
585
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
586
|
+
output application/java
|
|
587
|
+
---
|
|
588
|
+
{
|
|
589
|
+
""entity"": {
|
|
590
|
+
""internalId"": payload.AccountId
|
|
591
|
+
},
|
|
592
|
+
""itemList"": {
|
|
593
|
+
""item"": [{
|
|
594
|
+
""item"": {
|
|
595
|
+
""internalId"": ""1""
|
|
596
|
+
},
|
|
597
|
+
""quantity"": 1,
|
|
598
|
+
""rate"": payload.Amount default 0
|
|
599
|
+
}]
|
|
600
|
+
},
|
|
601
|
+
""tranId"": ""SF-"" ++ payload.Id,
|
|
602
|
+
""memo"": ""Order created from Salesforce Opportunity: "" ++ payload.Name,
|
|
603
|
+
""recordType"": ""salesOrder""
|
|
604
|
+
}]]></ee:set-payload>
|
|
605
|
+
</ee:message>
|
|
606
|
+
</ee:transform>
|
|
607
|
+
<netsuite:add doc:name=""Create Order in NetSuite"" doc:id=""netsuite1234-5678-90ab-cdef-ghijklmnopqr"" config-ref=""NetSuite_Config""/>
|
|
608
|
+
<logger level=""INFO"" doc:name=""Log Success"" doc:id=""logger1234-5678-90ab-cdef-ghijklmnopqr"" message=""Order created in NetSuite for Opportunity #[payload.Id]""/>
|
|
609
|
+
</when>
|
|
610
|
+
<otherwise>
|
|
611
|
+
<logger level=""DEBUG"" doc:name=""Log Skipped"" doc:id=""logger-skip"" message=""Opportunity #[payload.Id] not in Closed Won stage: #[payload.StageName]""/>
|
|
612
|
+
</otherwise>
|
|
613
|
+
</choice>
|
|
614
|
+
</flow>
|
|
615
|
+
</mule>","<salesforce:sfdc-config name=""Salesforce_Config"" doc:name=""Salesforce Config"" doc:id=""ce8fcc7f-04b4-4cb0-b53d-1a0aef47b8a3"">
|
|
616
|
+
<salesforce:basic-connection
|
|
617
|
+
username=""${salesforce.username}""
|
|
618
|
+
password=""${salesforce.password}""
|
|
619
|
+
securityToken=""${salesforce.securityToken}""
|
|
620
|
+
url=""${salesforce.authorizationUrl}"" />
|
|
621
|
+
</salesforce:sfdc-config>
|
|
622
|
+
|
|
623
|
+
<netsuite:config name=""NetSuite_Config"" doc:name=""NetSuite Config"" doc:id=""f05684d2-c3a6-40a2-9dd6-ba9313e5673c"">
|
|
624
|
+
<netsuite:token-based-authentication-connection
|
|
625
|
+
consumerKey=""${netsuite.consumerKey}""
|
|
626
|
+
consumerSecret=""${netsuite.consumerSecret}""
|
|
627
|
+
tokenId=""${netsuite.tokenId}""
|
|
628
|
+
tokenSecret=""${netsuite.tokenSecret}""
|
|
629
|
+
account=""${netsuite.accountId}"" />
|
|
630
|
+
</netsuite:config>","<dependency>
|
|
631
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
632
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
633
|
+
<version>11.1.0</version>
|
|
634
|
+
<classifier>mule-plugin</classifier>
|
|
635
|
+
</dependency>
|
|
636
|
+
<dependency>
|
|
637
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
638
|
+
<artifactId>mule-netsuite-connector</artifactId>
|
|
639
|
+
<version>11.10.0</version>
|
|
640
|
+
<classifier>mule-plugin</classifier>
|
|
641
|
+
</dependency>"
|
|
642
|
+
Create a Mule flow that creates an order in NetSuite every time an Opportunity in Salesforce is updated to stage Closed Won.,"<?xml version=""1.0"" encoding=""UTF-8""?>
|
|
643
|
+
<mule xmlns=""http://www.mulesoft.org/schema/mule/core""
|
|
644
|
+
xmlns:salesforce=""http://www.mulesoft.org/schema/mule/salesforce""
|
|
645
|
+
xmlns:netsuite=""http://www.mulesoft.org/schema/mule/netsuite""
|
|
646
|
+
xmlns:ee=""http://www.mulesoft.org/schema/mule/ee/core""
|
|
647
|
+
xmlns:doc=""http://www.mulesoft.org/schema/mule/documentation""
|
|
648
|
+
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
|
|
649
|
+
xsi:schemaLocation=""
|
|
650
|
+
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
|
|
651
|
+
http://www.mulesoft.org/schema/mule/salesforce http://www.mulesoft.org/schema/mule/salesforce/current/mule-salesforce.xsd
|
|
652
|
+
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
|
|
653
|
+
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"">
|
|
654
|
+
|
|
655
|
+
<flow name=""opportunity-to-order"" doc:id=""d1e2f3a4-b567-4c8d-90e5-123456789abc"">
|
|
656
|
+
<salesforce:modified-object-listener doc:name=""On Modified Opportunity"" doc:id=""abc12345-def6-7890-gh12-ijkl345678mn"" config-ref=""Salesforce_Config"" objectType=""Opportunity"">
|
|
657
|
+
<scheduling-strategy>
|
|
658
|
+
<fixed-frequency frequency=""1"" timeUnit=""MINUTES""/>
|
|
659
|
+
</scheduling-strategy>
|
|
660
|
+
</salesforce:modified-object-listener>
|
|
661
|
+
<choice doc:name=""Check Opportunity Stage"" doc:id=""choice1234-5678-90ab-cdef-ghijklmnopqr"">
|
|
662
|
+
<when expression='#[payload.StageName == ""Closed Won""]'>
|
|
663
|
+
<logger level=""INFO"" doc:name=""Log Closed Won Opportunity"" doc:id=""logger-before-transform"" message=""Processing Closed Won opportunity: #[payload.Id] - #[payload.Name]""/>
|
|
664
|
+
<ee:transform doc:name=""Prepare NetSuite Order"" doc:id=""transform1234-5678-90ab-cdef-ghijklmnopqr"">
|
|
665
|
+
<ee:message>
|
|
666
|
+
<ee:set-payload><![CDATA[%dw 2.0
|
|
667
|
+
output application/java
|
|
668
|
+
---
|
|
669
|
+
{
|
|
670
|
+
""entity"": {
|
|
671
|
+
""internalId"": payload.AccountId
|
|
672
|
+
},
|
|
673
|
+
""itemList"": {
|
|
674
|
+
""item"": [{
|
|
675
|
+
""item"": {
|
|
676
|
+
""internalId"": ""1""
|
|
677
|
+
},
|
|
678
|
+
""quantity"": 1,
|
|
679
|
+
""rate"": payload.Amount default 0
|
|
680
|
+
}]
|
|
681
|
+
},
|
|
682
|
+
""tranId"": ""SF-"" ++ payload.Id,
|
|
683
|
+
""memo"": ""Order created from Salesforce Opportunity: "" ++ payload.Name,
|
|
684
|
+
""recordType"": ""salesOrder""
|
|
685
|
+
}]]></ee:set-payload>
|
|
686
|
+
</ee:message>
|
|
687
|
+
</ee:transform>
|
|
688
|
+
<netsuite:add doc:name=""Create Order in NetSuite"" doc:id=""netsuite1234-5678-90ab-cdef-ghijklmnopqr"" config-ref=""NetSuite_Config""/>
|
|
689
|
+
<logger level=""INFO"" doc:name=""Log Success"" doc:id=""logger1234-5678-90ab-cdef-ghijklmnopqr"" message=""Order created in NetSuite for Opportunity #[payload.Id]""/>
|
|
690
|
+
</when>
|
|
691
|
+
<otherwise>
|
|
692
|
+
<logger level=""DEBUG"" doc:name=""Log Skipped"" doc:id=""logger-skip"" message=""Opportunity #[payload.Id] not in Closed Won stage: #[payload.StageName]""/>
|
|
693
|
+
</otherwise>
|
|
694
|
+
</choice>
|
|
695
|
+
</flow>
|
|
696
|
+
</mule>","<salesforce:sfdc-config name=""Salesforce_Config"" doc:name=""Salesforce Config"" doc:id=""ce8fcc7f-04b4-4cb0-b53d-1a0aef47b8a3"">
|
|
697
|
+
<salesforce:basic-connection
|
|
698
|
+
username=""${salesforce.username}""
|
|
699
|
+
password=""${salesforce.password}""
|
|
700
|
+
securityToken=""${salesforce.securityToken}""
|
|
701
|
+
url=""${salesforce.authorizationUrl}"" />
|
|
702
|
+
</salesforce:sfdc-config>
|
|
703
|
+
|
|
704
|
+
<netsuite:config name=""NetSuite_Config"" doc:name=""NetSuite Config"" doc:id=""f05684d2-c3a6-40a2-9dd6-ba9313e5673c"">
|
|
705
|
+
<netsuite:token-based-authentication-connection
|
|
706
|
+
consumerKey=""${netsuite.consumerKey}""
|
|
707
|
+
consumerSecret=""${netsuite.consumerSecret}""
|
|
708
|
+
tokenId=""${netsuite.tokenId}""
|
|
709
|
+
tokenSecret=""${netsuite.tokenSecret}""
|
|
710
|
+
account=""${netsuite.accountId}"" />
|
|
711
|
+
</netsuite:config>","<dependency>
|
|
712
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
713
|
+
<artifactId>mule-salesforce-connector</artifactId>
|
|
714
|
+
<version>11.1.0</version>
|
|
715
|
+
<classifier>mule-plugin</classifier>
|
|
716
|
+
</dependency>
|
|
717
|
+
<dependency>
|
|
718
|
+
<groupId>com.mulesoft.connectors</groupId>
|
|
719
|
+
<artifactId>mule-netsuite-connector</artifactId>
|
|
720
|
+
<version>11.10.0</version>
|
|
721
|
+
<classifier>mule-plugin</classifier>
|
|
722
|
+
</dependency>"
|