We are currently using Transactions in our project to save a single item then set a relationship. Everything works as expected.
We have a new requirement to return the saved objectId of the newly saved object.
after referring to the documentation we have tried the following example let objectIdReference = createPersonResult.resolveTo(propName: "objectId")
, however this seems to get reference to the object and not the objectId itself.
our question is there away to return the objectId and not the reference, if not can we use the reference in further api calls which are not in the same scope as the transaction
let unitOfWork = UnitOfWork()
let saveOperation = unitOfWork.create(tableName: "Tickets", objectToSave: objectToSave)
_ = unitOfWork.addToRelation(parentResult: saveOperation, columnName: "venu", childrenObjectIds: childrenObjectIds)
let objectIdRef = saveOperation.resolveTo(propName: "objectId") //return reference to the objectID and not the actual object id
unitOfWork.execute(responseHandler: { (result) in
//return objectID as String
completion(.success(result.isSuccess))
}) { (fault) in
completion(.failure(fault))
}
above is a code sample.
Thank you