+ Start a Discussion
Jaishree NaiduJaishree Naidu 

Error in Automate Order-to-Cash Process Using MuleSoft Flow Designer

I am working on Mulesoft Integration module Automate Order-to-Cash Process Using MuleSoft Flow Designer, while on step Trigger SMS Using the Twilio Connector, STEP 7 indicates  copying following code:
Body: "Order for " ++ vars.OppDetails.Name ++ " has been placed.
Details:
" ++ "OrderID: " ++ payload.OrderID as String ++ ", Tracking: "
++ payload.TrackingNo ++ ", ETA:" ++ payload.ETA as Date
The above code in the transform indicates error in Anypoint Platform:
Error: event:22c3f4a0-382e-11ea-b070-02766eec795c ********************************************************************************Message               : "You called the function 'Value Selector' with these arguments:   1: String ("payload" as String {encoding: "UTF-8", mediaType: "*/*; charset=UTF-8", mime...)  2: Name ("Id")But it expects one of these combinations:  (Array, Name)  (Array, String)  (Date, Name)  (DateTime, Name)  (LocalDateTime, Name)  (LocalTime, Name)  (Object, Name)  (Object, String)  (Period, Name)  (Time, Name)5|   OppId: vars.OppDetails.Id,            ^^^^^^^^^^^^^^^^^^Trace:  at main (line: 5, column: 10)" evaluating expression: "%dw 2.0output application/json  ---{  OppId: vars.OppDetails.Id,  OrderAmount: vars.OppDetails.Amount,  orderdate: vars.OppDetails.CloseDate,  productInfo: {    productID: payload[0].productID,    category: payload[0].category,    SKU: payload[0].SKU,    productName: payload[0].productName,    inventory: payload[0].inventory  }}".Element               : salesforce_to_twilio_connector/processors/2 @ ordertocashautomation-updu:mule-config.xml:38 (Transform)Element XML           : <ee:transform doc:id="069f6d19-8dbc-4dbb-ad0c-fe9fe9e40bf2" doc:name="Transform" doc:timestamp="1579157186684">                        <ee:message>                        <ee:set-payload>%dw 2.0                        output application/json                          ---                        {                          OppId: vars.OppDetails.Id,                          OrderAmount: vars.OppDetails.Amount,                          orderdate: vars.OppDetails.CloseDate,                          productInfo: {                            productID: payload[0].productID,                            category: payload[0].category,                            SKU: payload[0].SKU,                            productName: payload[0].productName,                            inventory: payload[0].inventory                          }                        }</ee:set-payload>                        </ee:message>                        </ee:transform>Error type            : MULE:EXPRESSIONFlowStack             : at salesforce_to_twilio_connector(salesforce_to_twilio_connector/processors/2 @ ordertocashautomation-updu:mule-config.xml:38 (Transform)) 125 msPayload Type          : org.mule.runtime.core.internal.streaming.object.ManagedCursorIteratorProvider--------------------------------------------------------------------------------Root Exception stack trace:org.mule.runtime.api.el.ExpressionExecutionException: You called the function 'Value Selector' with these arguments:   1: String ("payload" as String {encoding: "UTF-8", mediaType: "*/*; charset=UTF-8", mime...)  2: Name ("Id")But it expects one of these combinations:  (Array, Name)  (Array, String)  (Date, Name)  (DateTime, Name)  (LocalDateTime, Name)  (LocalTime, Name)  (Object, Name)  (Object, String)  (Period, Name)  (Time, Name)5|   OppId: vars.OppDetails.Id,            ^^^^^^^^^^^^^^^^^^Trace:  at main (line: 5, column: 10)    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.doEvaluate(WeaveExpressionLanguageSession.scala:130)    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.evaluate(WeaveExpressionLanguageSession.scala:77)    at org.mule.weave.v2.el.WeaveExpressionLanguageSession.evaluate(WeaveExpressionLanguageSession.scala:103)    at org.mule.runtime.core.internal.el.dataweave.DataWeaveExpressionLanguageAdaptor$1.evaluate(DataWeaveExpressionLanguageAdaptor.java:252)    at org.mule.runtime.core.internal.el.DefaultExpressionManagerSession.evaluate(DefaultExpressionManagerSession.java:38)    at com.mulesoft.mule.runtime.core.internal.processor.SetPayloadTransformationTarget.process(SetPayloadTransformationTarget.java:29)    at com.mulesoft.mule.runtime.core.internal.processor.TransformMessageProcessor.lambda$0(TransformMessageProcessor.java:87)    at java.util.Optional.ifPresent(Optional.java:159)    at com.mulesoft.mule.runtime.core.internal.processor.TransformMessageProcessor.process(TransformMessageProcessor.java:87)    at org.mule.runtime.core.api.processor.Processor.lambda$apply$0(Processor.java:55)    at org.mule.runtime.core.api.util.func.CheckedFunction.apply(CheckedFunction.java:19)    at org.mule.runtime.core.api.rx.Exceptions.lambda$checkedFunction$2(Exceptions.java:84)    at org.mule.runtime.core.internal.util.rx.Operators.lambda$nullSafeMap$0(Operators.java:45)    at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:165)    at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$1.onNext(AbstractMessageProcessorChain.java:292)    at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$1.onNext(AbstractMessageProcessorChain.java:285)    at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:127)    at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)    at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:345)    at reactor.core.publisher.FluxSubscribeOnValue$ScheduledScalar.run(FluxSubscribeOnValue.java:178)    at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:50)    at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:27)    at java.util.concurrent.FutureTask.run(FutureTask.java:266)    at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:111)    at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)    at java.lang.Thread.run(Thread.java:748)********************************************************************************



Kindly guide what can be done.
Mir Pasha 4Mir Pasha 4
I am running in the same issue. Appreciate any help from Mulesoft experts
Mitesh TrailblazerMitesh Trailblazer
I got similar error but in the Trnasform step. Is there any resolution?
Joseph WildeyJoseph Wildey

Mir, The code in Step 7 is quite bad.  It should read the following.
 

Body: "Order for "++ vars.OppDetails.Name ++"has been placed",
Details: "OrderID: " ++ payload.OrderID as String,
Tracking: "Tracking: " ++ payload.TrackingNo as String,
ETA: payload.ETA as Date
Joseph WildeyJoseph Wildey
@Mitesh
The instructions are wrong in lesson "Use Connectors to Get Product Information".  For step 5 you need to do the following:
  • Click Custom Expression in the list of items on the right side of the card and drag it into the Value field.
  • Click the arrow on the right side of the expression box and click EXPAND.
  • In the Custom Expression dialog, type payload in the Expression field.
Joseph WildeyJoseph Wildey
Same goes for "Update Opportunities with Order Details" when creating the varialble there.
Aurelio AlonsoAurelio Alonso
Hi All! Please, prove this: You have 2 Variable Cards: OppDetails and OrderDetails. Access and... in Cofiguration Tab: Field Value / Drag Custom Expression from de right side. Now Drop/Expand/ Type: Payload:
SetVariable
SetVariable2
Now in OrderDetails the same. Exactly the same!! I had the same issue and now it's running!!!
OrderDetails
Sebastien Robert 9Sebastien Robert 9
I confirm this solution is working. Thank you so much!