Stores the settings of statuses set up in an app.

Type parameters

Hierarchy

  • StatusField

Properties

Readonly all

all: TStatus<string, ItemData>[]

Array of all available app item statuses.

const statuses = Application.fields.__status.all;
// Get first  status in anarray 
const firstStatus = statuses[0]; 
// Get names of all  statuses 
const statusNames = statuses.map(status => status.name); 
// Find  status by code 'new' 
const newStatus = statuses.find(status => status.code ===  'new'); 

Please note that this field stores statuses from all the status groups. To get statuses from a specific group check the value of the TStatus.groupId field for the status:

const statuses =  Application.fields.__status.all;
const groups =  Application.fields.__status.groups; 
// Get names of all the statuses from a  group with the code 'sales' 
const statusNames = statuses.map(status =>  status.name && status.groupId === groups.sales.id); 
// Find a status by the  code 'new' in the group of default statuses 
const newStatus =  statuses.find(status => status.code === 'new' && status.groupId ===  groups.__default.id); 

If you need only the statuses from the default group, you can also use the data from the variants field

Readonly groups

groups: object

List of status groups set up for an app.

Every app has a group of default statuses. It is stored in the __default field. Status groups are only used in the CRM workspace in the system apps Leads and Deals to represent pipelines. It is impossible to create status groups in other apps.

const  groups = Application.fields.__status.groups;
// Getting the name of the  default status group 
const defaultStatusGroupName = groups.__default.name;  
// Getting the names of statuses from the status group with the code `sales`  
const allSalesStatusNames = groups.sales.all.map(status => status.name);  

Type declaration

Readonly variants

variants: object

List of app item statuses from the default statuses group.

const variants = Application.fields.__status.variants;
// Get  the name of the status with code 'new' 
const newStatusName =  variants.new.name; 

Type declaration