Dynamics Mobile Studio implements simple Object Relational Mapping (ORM) engine
Dynamics Mobile Studio and the javascript API provide the developers with the ability to store relational data into the mobile storage and access it as business objects.
Actually the Dynamics Mobile Studio forces the developer to define the mobile storage as a set of business object types. It provides a dedicated user interface to ease the business object definition.
The developer can click over the Business Object section on the left to expand the list of the available business objects. Note that the developer will see only the list of the business objects available in the current customization layer.
The developer can:
- Click over any of the existing business objects definitions to modify it.
- To click the New Business Object button to create a business object definition.
- To select a set of business objects by clicking the checkboxes next to each and click the Delete button to delete them.
- Click the Update Mobile Database button to update the local device storage of the mobile user currenly used for development
The business object definition is used by Dynamics Mobile Studio to create or update the mobile storage, to synchronize it with the ERP and to generate code allowing the developer to access the data in terms of business objects.
Please consult with the Mobile Apps Dev section for more information.
Adding new business object
New business objects can be added by clicking the New Business Object button on top. It will open the New Business Object Page, where the developer can specify the attributes of the new business object definition.
The developer has to enter:
- The name of the business object. This name will be used by the developer when refering to the business object via the code (javascript API)
- The SyncTag of the business object. The SyncTag identifies the business object into the SyncPacket and will be used by the linked ERP to identify the business object when synchronizing. So the SyncTag must be “negotiated” with the ERP developers/integrators. It must correspond to the Table Mapping in the Dynamics Mobile Addon in the ERP
- The TableName is the name of the relational table under which the business objects of this type will be stored. It can be used by the developer to access the data via direct SQL queries.
It is recommended to keep the Name, SyncTag and TableName equal if possible – e.g. keep them with one and the same.
The developer has to click the Save button to actually create the business object definition.
Next the developer has to find the new business object definition into the list and click over it to add fields/members definitions.
Changing existing business object definition and adding members/fields
The Business Object Definition page allows the developer to change the general attributes like Name,SyncTag and Table name and Sync direction.
The developer can change these attributes and click the Save button on top to persist the changes.
Note that the page displays the list of the business object members(consider them as table columns) at the bottom under the Business object mebers title
The developer may:
- Add new member to the business object definition by clicking the Add Member button
- Change existing member by clicking the pencil icon next to the member
- Deleting the member by clicking the X icon next to the member
The developer has to define the following attributes for the business object members:
- Name – the name of the member as it will be refered from the Mobile API(JS). This name will be published as member of the business object class.
- Type – the data type of the member selected from a list of supported types. Note that the type is mostly used during the synchronziation process. The framework will not prevent you from assigning wrong data-type values to business object members.
- Field – the name of the database field where the member will stored. It can be used in direct SQL Expression to pass by the business object API.
- Length – the maximum length of the database field. It is used only for members of type System.String
- Required – specifies if the field value is required.
- PK – specifies if the field is used as Primary Key. You can use composite primary keys by specfying the PK field for multiple fields. They will be used in the order of presence in the Business object members list.
- SyncTag – the name which will be used when embedding the member into SyncPackets. The SyncTag must be “negitiated” with the linked ERP developers/vendors
Aftet the business object is defined, we may use it:
- In API calls in the CODE section
- In API calls in the Views section
- In Declarative Data Model expressions in views
Please consult with Mobile App Development section for more information about the business objects