Reputation: 154
I have below input
{
"OrderId": "TST-test-123212-01",
}
I have to fetch sfdc id using this value from a variable which I get from another source. I tried with below code
%dw 2.0
output application/json
var lis = {
"TST-test-123212-01": "a2F2h000000pMl8EAE",
"TST-test-123212-02": "a2F2h000000q6qHEAQ"
}
fun getSFDCId (items) = lis.items
---
{
OrderId__c: getSFDCId(payload.OrderId)
}
in function lis.items Dataweave is expecting value to be coming as lis."TST-test-123212-02" which might not be happening when passed dynamically.
Can someone guide me where I am configuring wrong.
Upvotes: 1
Views: 1335
Reputation: 25812
Use DataWeave dynamic selector to evaluate a key dynamically. Example: lis[items]
.
Upvotes: 2