I am running into an issue when I am doing a transaction that first creates a nested object that I then want to relate to its parent. Here is my rest body
{
"isolationLevelEnum": "SERIALIZABLE",
"operations": [
{
"operationType": "CREATE",
"table": "ItemExpense",
"opResultId": "createItemExpense",
"payload": {
"expense_name": "${expense_name}",
"purchase_price": "${purchase_price}",
"unit_of_measurement": "${unit_of_measurement}",
"quantity_of_unit": "${quantity_of_unit}"
}
},
{
"operationType": "CREATE",
"table": "CreationLog",
"opResultId": "saveInLog",
"payload": {
"object_created": {
"___ref": true,
"opResultId": "createItemExpense",
"propName": "objectId"
},
"table_name": "ItemExpense"
}
},
{
"operationType": "ADD_RELATION",
"table": "Item",
"opResultId": "addItemExpenseRelationToItem",
"payload": {
"parentObject": "${parent_object_id}",
"relationColumn": "item_expenses",
"unconditional" : {
"___ref": true,
"opResultId" : "saveInLog",
"resultIndex" : 1
}
}
}
]
}
What I get back is this error:
{
"success": false,
"error": {
"operation": {
"operationType": "ADD_RELATION",
"table": "Item",
"opResultId": "addItemExpenseRelationToItem",
"payload": {
"conditional": null,
"unconditional": {
"___ref": true,
"opResultId": "saveInLog",
"resultIndex": 1
},
"parentObject": "B3201532-5B98-47C0-907E-021CBB86FEEB",
"relationColumn": "item_expenses"
}
},
"message": "Unable to perform 'ADD_RELATION' operation due to argument incompatibility. The operation references a result from another 'CREATE' operation. The specified result cannot be obtained from this operation (list of objectIds)."
},
"results": null
}
Not sure what the issue is.