我試圖找出如何得到使用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)