import * from modules::b2blookuputils
Using Lookup Tables in DataWeave
Use DataWeave lookup utility functions to retrieve values from Partner Manager lookup tables during map execution.
To call lookup tables from DataWeave, import the lookup utilities module:
Function Compatibility by Lookup Table Type
Lookup functions are type-specific and can’t be used interchangeably.
| Function | Supported table type |
|---|---|
|
Composite Key Lookup only |
|
Cross-Reference Lookup only |
|
Generic-enabled tables only |
|
Generic-enabled tables only |
| If a function is called with an unsupported table type, the lookup call fails. |
Composite Key Lookup
Function: b2bCompositeKeyLookup(tableName, lookupObject, failIfNoMatchFound)
Use this function only with Composite Key Lookup table types.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
|
String |
Yes |
Lookup table name. |
|
Object |
Yes |
Key-value pairs where each key is a table column name and each value is the value to match. |
|
Boolean (default |
No |
If |
Response
| Field | Type | Description |
|---|---|---|
|
String |
Lookup operation status. |
|
String |
Error details when the operation fails. |
|
Object |
Matching row data. |
Example:
%dw 2.0
output application/json
import * from modules::b2blookuputils
---
b2bCompositeKeyLookup(
"B2B-Customer-Order-Profile",
{"PARTNER_ID": "PARTNER_001", "CUSTOMER_NAME": "ACME_RETAIL"},
true
)
Cross-Reference Lookup
Function: b2bCrossReferenceLookup(tableName, columnName, columnValue, failIfNoMatchFound)
Use this function only with Cross-Reference Lookup table types.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
|
String |
Yes |
Lookup table name. |
|
String |
Yes |
Key column name. |
|
String |
Yes |
Value to search in the key column. |
|
Boolean (default |
No |
If |
Response
| Field | Type | Description |
|---|---|---|
|
String |
Lookup operation status. |
|
String |
Error details when the operation fails. |
|
Object |
Matching row data. |
Example:
%dw 2.0
output application/json
import * from modules::b2blookuputils
---
b2bCrossReferenceLookup("Item_Code_Mapping", "Internal_SKU", "SKU-5520", true)
Generic Lookup
Function: b2bGenericLookup(tableName, failIfNoMatchFound)
Use this function only with tables where generic lookup is enabled.
Generic Lookup with Filter
Function: b2bGenericLookupWithFilter(tableName, lookupObject, failIfNoMatchFound)
Use this function only with tables where generic lookup is enabled.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
|
String |
Yes |
Lookup table name. |
|
Object |
Yes |
Key-value pairs used as filters. |
|
Boolean (default |
No |
If |
Response
| Field | Type | Description |
|---|---|---|
|
String |
Lookup operation status. |
|
String |
Error details when the operation fails. |
|
Array<Object> |
One or more rows matching the provided filters. |
Example:
%dw 2.0
output application/json
import * from modules::b2blookuputils
---
b2bGenericLookupWithFilter(
"Payment_Terms_Mapping",
{"Internal_Terms_Code": "NET30", "Salesforce_Payment_Term": "Net 30"},
true
)
If a transformation requires multiple lookups from the same table, retrieve table data once with b2bGenericLookup and then filter locally in DataWeave.
|
For lookup table concepts and type selection guidance, see Configuring and Managing Lookup Tables.



