我试图找出如何得到使用Mulesoft NetSuite的连接器返回的搜索有效载荷值。MuleSoft NetSuite的连接器搜索
无论何时使用此连接器,它返回的输出为List<Map<String, Object>>
,我不确定是否有方法使用DataWeave并映射返回的值,因为此类型的输出。
有没有办法真正得到名单的组成部分,并使用Dataweave其映射到别的东西?
举一个例子,我抓住使用#[payload.hasNext() ? 'Employee Found: ' + payload.next().get('internalId') : 'Employee Not Found']
搜索结果记录的internalId,我能顺利拿到价值。
在另一种情况下,我尝试使用NetIdite连接器的“获取记录”功能使用internalId,我尝试以同样的方式输入internalId参数payload.next().get('internalId')
,并得到如下错误。
<netsuite:get-record config-ref="NetSuite_Login_Auth" internalId="#[payload.next().get('internalId')]" type="EMPLOYEE" doc:name="NetSuite"/>
错误:
Message : Failed to invoke getRecord. Payload
: [email protected] Payload Type : org.mule.streaming.ConsumerIterator Element : /streamMigrateAccountToCustomer/processors/10/0/1/0/1/searchEmployeeByEntityId/subprocessors/3/1/0 @ sfdc-netsuite-api Element XML : -------------------------------------------------------------------------------- Root Exception stack trace: java.util.NoSuchElementException at org.mule.streaming.AbstractConsumer.consume(AbstractConsumer.java:70) at org.mule.streaming.ConsumerIterator.next(ConsumerIterator.java:60) at sun.reflect.GeneratedMethodAccessor148.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)