Skip to content

Triggering Update Event

To trigger an event, update an existing Order object in the Backendless database. This can be done with any Backendless SDK (Android, iOS, JS, .NET), REST API or Backendless Console:

Consider the following class:
@interface Order : NSObject

@property(strong, nonatomic) NSString *objectId;
@property(strong, nonatomic) NSString *orderName;
@property(strong, nonatomic) NSNumber *orderAmount;

@end
The code below creates an instance of the class and saves in the Backendless Database:
Order *order = // an existing Order object
order.orderAmount = @2150;

DataStoreFactory *dataStore = [Backendless.shared.data of:[Order class]];
[dataStore updateWithEntity:order responseHandler:^(Order *updatedOrder) {
    NSLog(@"Order has been updated");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
Consider the following class:
@objcMembers class Order: NSObject {
    var objectId: String?
    var orderName: String?
    var orderAmount: NSNumber?
}
The code below creates an instance of the class and saves it in the Backendless Database:
let order = // an existing Order object
order.orderAmount = 2150;

let dataStore = Backendless.shared.data.of(Order.self)
dataStore.update(entity: order, responseHandler: { updatedOrder in
    print("Order has been updated")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

NSMutableDictionary *order = // an existing Order object
order[@"orderAmount"] = @2150;

MapDrivenDataStore *dataStore = [Backendless.shared.data ofTable:@"Order"];
[dataStore updateWithEntity:order responseHandler:^(NSDictionary *updatedOrder) {
    NSLog(@"Order has been updated");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
var order = // an existing Order object
order["orderAmount"] = 2150;

let dataStore = Backendless.shared.data.ofTable("Order")
dataStore.update(entity: order, responseHandler: { updatedOrder in
    print("Order has been updated")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})