Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Mule#4: Dataweave: Query value based on a filed

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Can someone guide me where I am configuring wrong.

>Solution :

Use DataWeave dynamic selector: lis[items].

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading