All the system objects are described as one-level systems, where field codes are compared with specific types. The types can be divided into four classes:

  • primitive (TString, TFloat, TBoolean, TLink);
  • structural (TFullName, TPhone, TEmail,);
  • class instances (TDatetime, TMoney, TEnum, TTable, TStatus);
  • links to system objects (TCategory, TFile, TImage, TUser, TApplication,). There is also a special type TJSON used for storing unstructured data. The instances of the type are construct differently depending on the class.

    Primitive types

    The primitive types are comparable with the TypeScript primitive
    types
    , for example, in the process context there is comment field of the TString type, with which you can work as with a regular string:
    Context.data.__comment = `The script was executed successfully!`;
    

    Structural types

    The structural types are basically an object in terms of javascript, for example, we can work with the initiator’s full name (TFullName type) in the following way:
    const initiator =  await Context.data.__createdBy.fetch();
    const fn = initiator.data.fullname;  
    Context.data.__comment = `The script was run by ${ fn.firstname } ${  fn.lastname }`; 
    

    Class instances

    The class instances are created with a constructor or field description. For example, if there is a total field of the TMoney type in the context, you will need to do the following to fill it in: ```typescript Context.data.total = new Money(17999.99, 'RUB');
    To add a string to a <a href="../interfaces/_dts_02_types_.ttable.html">TTable</a> type field, do the following:
    ```typescript 
    // Get order 
    const order = await  Context.data.orders!.fetch(); 
    // Insert 
    row.item = Context.data.product!;  
    row.amount = Context.data.amount!; 
    // Fill it in row.item =  Context.data.product!;row.amount = Context.data.amount!;// Save the order  
    await order.save(); 
    
    Please note that the table will be updated only after the app item is saved.

    Links to objects

    Links to system objects have the fetch method, which is used to get the object itself. You can read more about objects in Object Types.

    Field description

    Each type has a description objecth, which is used for
    constructing objects or for other operations. For example, if there is the participants field of the Users (many-to-many) type in the context, the field will store an array of links TUser, and to get an array of users you will be able to use the field’s description with the UserField type, which includes the method UserField.fetchAll:
    const  participants = await Context.fields.participants.fetchAll();
    
    If there is an app-type order field in the context, you can use the description of this
    field to access the app directly, for example, to create a new app item:
    const order = Context.fields.order.app.create();
    order.client = Context.data.client; 
    await order.save(); 
    Context.data.order  = order; 
    

Type aliases

ReplacementTypeEnumBase

ReplacementTypeEnumBase: Information | Reassign | Full

information - informing reassign - task reassignment full - complete transfer of access privileges

TApplication

TApplication: ApplicationItemRef<Data, Params>

TBoolean

TBoolean: boolean

Boolean

TCategory

TCategory: CategoryItemRef<C>

Link to category

TFile

Link to file

TFloat

TFloat: number

Integer

TImage

TImage: ImageItemRef

Image

TJSON

TJSON: any

TLink

TLink: string

URL

TRefItem

TRefItem: RefItem

TString

TString: string

String

TUser

User