An error occurred while executing a save: Expression evaluation error in rule 'cas_getcashentryid' at function a!queryFilter [line 28]: Could not cast from Dictionary to Number (Integer). Details: CastInvalid

I have this code below and I'm encountering An error occurred while executing a save: Expression evaluation error in rule 'cas_getcashentryid' at function a!queryFilter [line 28]: Could not cast from Dictionary to Number (Integer). Details: CastInvalid. Please help

with(ri!sourceTransactionId: rule!CAS_getSourceTransaction(
depositId: ri!deposit.depositId
),
local!sourceCashEntries: rule!CAS_getCashEntryId(
cashEntryIdSource: ri!sourceTransactionId
),
{if(local!sourceCashEntries.allocationTypeId = 5,
{
a!save(local!sourceCashEntries.suspenseIsOpen, 1),
a!save(local!sourceCashEntries.isAdjusted, 0)
},
a!save(local!sourceCashEntries.isAdjusted,1)
),
a!save(ri!sourceCashEntries,local!sourceCashEntries)}
),
a!writeToDataStoreEntity(
valueToStore: a!entityData(
entity: cons!CAS_DSE_CASH_ENTRY,
data: ri!sourceCashEntries
),
onSuccess: a!save(
ri!sourceCashEntries,
fv!storedValues[3].data
)
),

  Discussion posts and replies are publicly visible