Skip to main content
All CollectionsTools
Custom Model Reference
Custom Model Reference

Custom models provide a framework for temporary data received from webservices, pages or actions.

Betty Blocks avatar
Written by Betty Blocks
Updated over a week ago

Warning!

This is a legacy document. The features described below are only usable within the classic-generation environment.

Currently, Betty Blocks offers faster and more advanced options that are available in next-gen. Before you start working on some new features in your application, consider doing it using the next-gen version. Good luck!

What are Custom Models

Custom models provide a framework (or handler) for temporary data received from webservices, pages or actions. To simplify assigning values to action events or user interface components, data is stored as an object or collection. You can display custom models from the Tools > Custom models.

Using custom models

You can use custom models in endpoints and actions as a source of input and output for data. You can also manage variables by creating a single custom model. See What are custom models? for more information.

Creating a new custom model

To create a custom model, click on the New (A) button. The Custom model (B) dialog is opened. Specify the name for the model (C) and then press the Save (D) button to save the details. Once saved, you can now apply Attributes for defining the contents for the model.

Applying Attributes to a custom model

Click on the Edit (A) button to open the Attribute (B) pane. Specify the

Press the Save button to save the attribute details. The Attribute list is displayed. You can add additional attributes by pressing the New (F) button.

Note: Model generated based on a webservice contain default attributes based on the webservice.

Note 1: Models generated based on a webservice contain default attributes based on the webservice.

Note 2: Once applied, you should use caution where you want to delete or change the name of a model. Any dependencies associated with a model can be affected and this can cause errors in your application.

More information about dependencies can be found here: What are Dependencies?

Specifying the Kind for attribute

When you apply attributes to a model, you can also specify the Kind (A) option to apply to the attribute. A list of options is available when you click on menu (B) button.

The attribute details and validation options adjust based on the Kind you apply to the attribute.

Collection Attributes

These attributes can be used to refer to a collection of custom models or attributes.

When you set an attribute as a Collection (A) and the Name for the attribute. You can specify the Construct (B), what the attribute consists of, from the menu options. You can select an existing custom model or attribute or create a new custom model (New). You can then nest attributes within this collection.

You can use the Validation (C) checkboxes to validate the presence of the attribute and of the custom model.

Press the Save button to save the attribute details.

When you select New, you can create additional attributes or models nested in this model.

Custom Model attributes

When you select Custom model (A) as the attribute Kind, you can specify the custom model that you want to use from the menu (B). You can choose the model itself in which you are applying the attribute, a model from the list, or create a new model.

Specify a Name for the attribute that supports identifying its purpose.

You can use the Validation (C) checkboxes to validate the presence of the attribute and of the custom model.

Press the Save button to save the attribute details.

Where you create a new custom model, you can now edit the model to create additional attributes for that newly created model.

Linked attributes

You can assign Linked property (A) as the attribute kind for linking the attributes to a model's properties. When you select a Model (B), the properties for the model are displayed in the Property pull-down menu (C).

Additional validation options are available when you assign Linked properties. For example, the Inherit property-validations (D) checkbox. Any property validation from the model are applied.

Editing attributes

You can edit a custom model by pressing the Edit button at the top right of their details screen. This’ll send you to the same screen as when you first made your attribute, and you can edit it there.


Using custom models

You can use custom models in endpoints and actions as a source of input and output for data. You can also manage variables by creating a single custom model. See What are custom models? for more information.

Did this answer your question?