Create object


In order to create a record and save the data to our table, we will use the next format and set our attributes with the 

set   command.

var Cars = Simbla.Object.extend("Cars");
var car = new Cars();
car.set("car_year", 2014);
car.set("car_model", "Test car");
car.set("car_code", 12468);
car.set("car_color", "red");
car.set("available", true);
car.set("stock", 5);
car.save(null, {
      success: function(car) {
            alert('New object created with objectId: ' + car.id);
       },
       error: function(car, error) {
             alert('Failed to create new object, with error code: ' + error.message);
       }
});

Here is another example doing the same action. Here we will set our attributes under the  save   command.

var Cars = Simbla.Object.extend("Cars");
var car = new Cars();
car.save({
  car_code: 12468,
  car_model: "Test car",
  car_year: 2014,
  car_color: "red",
  available: true,
  stock: 5,
   }, {
        success: function(car) {
     // Object saved successfully.
       alert('New object created with objectId: ' + car.id);
    },
 
       error: function(car, error) {
        // Object saving failed.
       // error is a Simbla.Error with an error code and message.
          alert('Failed to create new object, with error code: ' + error.message);
      }
 });

After publishing and running the code, you can go to your table in your database and see how a new record has been added with the data you entered. Please make sure you hit the refresh button above your table.

Here is how our table looks after running the code:

As you can see, there are three automatic fields provided by the the system for your convenience and for future use:

1. objectId - a unique string identifying each saved record.

2. createdAt - the exact time and date the record was created.

3. updatedAt - the exact time and date of the last modification made.

About Simbla

We believe that end users know exactly what they need to perform more efficiently and effectively. Simbla allows them to produce game-changing cloud CRM without writing a single line of code.

Simbla is an AI-generated cloud CRM and a no-code development platform that helps non-coders build quick, flexible, efficient solutions quickly and easily.

Our team has years of experience developing sophisticated cloud-based systems. Drawing on that experience, we built a platform that allowed non-coders to create a tailored CRM that exactly fits the business needs without long deployment and without the help of professionals.

It is a no-code platform with an AI layer, capable of reducing the cost of deploying and maintaining a tailored cloud CRM by as much as 90%.