Skip to content

Commit

Permalink
Adds explanatory comments to DataWeave script
Browse files Browse the repository at this point in the history
  • Loading branch information
jamessimone committed Oct 31, 2024
1 parent e690b5d commit 06cddd7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rollup/core/dw/jsonToRollupState.dwl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
input records application/json
output application/apex

// if the attributes property, which only exists on serialized SObjects, is present when trying to deserialize
// it leads to the following error: System.DataWeaveScriptException: Error writing item: Invalid field "attributes" for type "{your SObject Type}"
var getCompliantSObject = (item) -> item filterObject (value, key) -> (("" ++ key) != "attributes")
---
// String coercion used to avoid errors like:
// Invalid type: "org.mule.weave.v2.model.values.MaterializedAttributeDelegateValue"
records map (record) -> "" ++ record.typeName match {
// regex here handles namespaced versions of the class name
case matches /(.*\.|)RollupState\.SObjectInfo/ -> {
key: record.key,
keyLength: record.keyLength,
Expand Down

0 comments on commit 06cddd7

Please sign in to comment.