Hello. Why are you mixing JSON strings and plain text or integers together in the same field without handling them separately? Have you checked if you’re referencing the right property for each audit record instead of a global variable?
I mean, genuinely asking if this is intentional, like for example in this snippet:
changedData: If(
StartsWith(varAuditResult.changedattribute, "{") || StartsWith(varAuditResult.changedattribute, "["),
// Trying to parse JSON here directly from varAuditResult.changedattribute
ForAll(
Table(ParseJSON(varAuditResult.changedattribute)),
{
LogicalName: Text(Value.logicalName),
OldValue: If(IsBlank(ThisRecord.Value.oldValue), "null", Text(ThisRecord.Value.oldValue)),
NewValue: Text(Value.newValue)
}
),
// Else treating changedattribute as plain text or integer
Collect(
colParsedAuditData,
{
LogicalName: "",
OldValue: "",
NewValue: Text(ThisRecord.Value)
}
)
)
In this snippet, varAuditResult.changedattribute is being used directly inside the loop for each audit record instead of Value.changeData, and there’s no proper check or separate handling for when changedattribute is just plain text or a number. This causes parsing errors and data inconsistency.