Skip to content

Triggering Create Event

To trigger an event, create and save a new instance of the Order object in the Backendless database. This can be done with any Backendless SDK (Android, iOS, JS, .NET), REST API or Backendless Console:

HashMap<String, Object> orderObject = new HashMap<String, Object>();
orderObject.put( "orderAmount", 1200 );
orderObject.put( "orderName", "Sample Order" );
Backendless.Data.of( "Order" ).save( orderObject, new AsyncCallback<Map>()
{
  @Override
  public void handleResponse( Map savedOrder )
  {
    Log.i( "MYAPP", "Object has been saved in the database - " + savedOrder.get( "objectId" ) );
  }

  @Override
  public void handleFault( BackendlessFault fault )
  {
    Log.e( "Server reported an error " + fault.getDetail() );
  }
} );

Order class:

package com.company;

public class Order
{
  public String objectId;
  public String orderName;
  public Double orderAmount;
}
Creating an instance of Order and saving it in the database:
Order order = new Order();
order.orderAmount = 1200d;
order.orderName = "Sample Order";

Backendless.Data.of( Order.class ).save( order, new AsyncCallback<Order>()
{
  @Override
  public void handleResponse( Order savedOrder )
  {
    Log.i( "MYAPP", "Order object has been saved in the database - " + savedOrder.objectId );
  }

  @Override
  public void handleFault( BackendlessFault fault )
  {
    Log.e( "Server reported an error - " + fault.getDetail() );
  }
} );