Transaction fail with relation

@olhadanylova, please see the conversation above and create an example for Robert. Thanks!

Hello Robert,

According to the documentation this method

func setRelation(parentValueReference: OpResultValueReference,
                 columnName: String,
                 childrenResult: OpResult) -> OpResult

requires your children to be the result of the find or bulk create operation:

At the moment Swift-SDK doesn’t provide methods to set relations using the OpResult of single created object as a children parameter, so please use the bulkCreate method instead:

let uow = UnitOfWork()
let items = [getBEUserProperty()]
let createOrderItemsResult = uow.bulkCreate(objectsToSave: items)
_ = uow.setRelation(parentObject: Backendless.shared.userService.currentUser!, columnName: kUserPropKey, childrenResult: createOrderItemsResult)
uow.execute(responseHandler: { result in
    print("Is transaction successful - \(result.isSuccess)")
    // dump(objectIdReference)
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

I’ve created an internal ticket BKNDLSS-22315 to discuss this omission.

Regards,
Olha