1

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.

aled
  • 21,330
  • 3
  • 27
  • 34
Prudhvi B
  • 144
  • 2
  • 13

1 Answers1

2

Use DataWeave dynamic selector to evaluate a key dynamically. Example: lis[items].

aled
  • 21,330
  • 3
  • 27
  • 34