- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Use cases
-
API
-
Object types
- DispositionType
- ProcessInstanceState
- ProcessTaskState
- ApplicationItemRegistration
- ApplicationProjectItem
- ApplicationProjectItemRef
- ApplicationProjectPlanElementItem
- ApplicationProjectPlanElementItemRef
- BaseApplicationItem
- BaseApplicationItemRef
- BaseItem
- BaseItemData
- CurrentUserItem
- DirectoryData
- DirectoryItem
- EmployeeItemData
- EmployeeItemParams
- EmployeeItemProcesses
- FileData
- FileItem
- FileItemRef
- FileVersionData
- FileVersionItem
- ImageData
- ImageItem
- ImageItemRef
- InstanceAddr
- Item
- ItemData
- ItemRef
- MailMessageData
- MailMessageItem
- MailMessageItemRef
- OrganisationStructureData
- OrganisationStructureItem
- OrganisationStructureItemRef
- ParamsItem
- ProcessInstanceData
- ProcessInstanceItem
- ProcessInstanceItemRef
- ProcessTaskData
- ProcessTaskItem
- ProcessTaskItemRef
- ProcessTemplate
- ProcessTimer
- ReminderData
- ReminderItem
- ReplacementData
- ReplacementItem
- StatusHistoryData
- StatusHistoryItem
- StatusHistoryItemRef
- TaskItemExit
- UserData
- UserGroupData
- UserGroupItem
- UserGroupItemRef
- UserItem
- UserItemRef
- ApplicationItem
- ApplicationItemRef
- Data types
- Global constants
- Work with apps
- Web requests
- Access permissions
- Document flow
- Live Chats
- “Code” widget
- Signatures
- Business calendars
- Integration with IP telephony
- Integration with email marketing services
-
Object types
Item of the "Project Plan Element" app
Type parameters
Data: ProjectPlanElementItemData | ItemData
Params: ItemData
_Processes: Processes
I: Item<ItemData>
TProcesses: Processes
I: Item<ItemData>
Hierarchy
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly data
Values of object’s fields.
Readonly fields
Description of the object’s fields.
Readonly id
ID of the URL’s target.
Readonly namespace
Namespace of the URL target (the code of the workspace that the app belongs to).
Methods
delete
The method allows you to delete an app item.
await Context.data.app.delete();
Returns Promise<void>
docflow
This method returns an object to work with document management operations.
const item = await Context.data.n1; const approvalLists = await item.docflow().getApprovalLists();
Returns DocflowApplicationItemRef
fetch
Request complete data of a reference object.
Returns Promise<BaseApplicationItem<Data, Params>>
getDataSigns
The method receives the internal signature of the app’s data.
While calculating internal signatures of an app, the system considers user signing settings. The data it obtains consists of a set of signatures of two types, for attributes and for files. Each signature includes:
hash
: signature applied to the app’s data.body
: data that hash is calculated for.type
: signature type. In the example below, the context includes:document1
: a Document type app that includes signature settings In the example, the system searches for the signature and useshash
andbody
to save the obtained signature.const app = await Context.data.document1.fetch(); const dataSigns = await app.getDataSigns(); const dataSign = res.find( (res: any) => res.type === SignType.File); const newSign: NewSign = { sign: 'aGVsbG8=', codeProvider: 'External', body: btoa(app.data.__file!.id), hash: dataSign.hash } await app.uploadSign(newSign);
Returns Promise<SignData[]>
getFolder
The method returns the folder from the folder tree that an item is in.
const item = await Context.data.n1; const folder = await item. getFolder();
Returns Promise<TFolder | undefined>
getPermissions
The method retrieves access permissions set for the app item.
Use this method if you need to add new access permissions to the existing ones.
// Let’s grant the process initiator access to the app item const item = await Context.data.request.fetch(); const user = Context. data.__createdBy; // We need to retrieve the current access permissions const currPermissions = await item.getPermissions(); currPermissions.values .push(new PermissionValue(user, [PermissionType.READ])); await item. setPermissions(currPermissions);
Returns Promise<TPermissions>
getRegistrations
Deprecated
Deprecated. Get a list of registrations of an app item.
const item = Context.data.d1! await item.getRegistrations();
As the method is deprecated, use docflow instead:
const item = Context.data.d1! await item.docflow().getRegistrations();
Returns Promise<ApplicationItemRegistration[]>
getSettings
The method returns an app’s settings.
const app = Context.data.dokument; if (app === undefined) { return; } const settings = await app.getSettings();
Returns Promise<TSettings>
getSignHistory
The method gets the history of an app item’s signatures.
// Example of saving signatures to context variables of the File type const app = await Context.data.dokument!.fetch(); const signHistory = await app.getSignHistory(); Context.data.sign_attributes = await signHistory[0].signs[0].createSignFile(); const attributes = await signHistory[0].signs[0].createAttributesFile(); if (attributes !== undefined) { Context.data.attributes = attributes; }
Returns Promise<EntityVersion[]>
getSubscribers
List of users subscribed to the app item’s activity stream.
// Let’s write the app item’s subscribers to the context const subscribers = await item.getSubscribers(); Context.data.subscribers = subscribers;
Returns Promise<TUser[]>
hasPermission
The method checks permissions of a user, group, org chart item, or role.
Parameters
orgunit: TPermissionOrgunit
type: PermissionType
Returns Promise<boolean>
manualRegister
Deprecated
Deprecated. Manual registration of an app item (if manual registration is enabled in the folder’s settings).
As the method is deprecated, use docflow instead:
const item = Context.data.d1! const settings = await Application.getSettings(); settings .registrationSettings.nomenclatureIds.forEach(nomenclatureId => { item. docflow().manualRegister('Number 1', nomenclatureId); })
Parameters
nameReg: string
nomenclatureId: string
Returns Promise<boolean>
normalize
Delete duplicate data in arrays.
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents). For example, you can call this method after bulk editing data within an object.
const app1 = await Context.data.app1.fetch(); const app2 = await Context.data.app2 .fetch(); app1.data.executors.push(app2.data.executors); app1.normalize(); // Now we need to go over the elements in the new array app1.data.executors .forEach( ... );
Returns void
register Deprecated
Deprecated. Automatic app item registration.
As the method is deprecated, use docflow instead:
const item = Context.data.d1! const settings = await Application.getSettings(); settings.registrationSettings.nomenclatureIds.forEach(nomenclatureId => { item.docflow().register(nomenclatureId); })
Parameters
nomenclatureId: string
Returns Promise<boolean>
restore
The method allows you to restore a deleted app item.
await Context.data.app.restore();
Returns Promise<void>
save
The method saves an app item.
You need to save app items when their data changes.
const request = await Context.data.service_request.fetch(); request.data.responsible = Context.data.responsible; await request.save();
Returns Promise<void>
sendMessage
The method allows sending messages to an app item’s activity stream.
Parameters
title: string
message: string
Returns Promise<void>
setFolder
The allows you to change the app item’s folder in the Folder hierarchy.
Parameters
id: string
Returns Promise<void>
setPermissions
The method sets new access permissions for an app item.
This method completely replaces the existing permissions with new ones.
There is no point to configure the permission to create an existing app item, so the
PermissionValue.Create
value is not available.Parameters
permissions: TPermissions
Returns Promise<void>
setStatus
The method changes the status of an app item.
The status changes immediately after the method is executed. You don’t need to call the method.
Parameters
status: TStatus<any, any>
Optional comment: undefined | string
Returns Promise<boolean>
subscribe
The method allows you to subscribe a user to updates in the activity stream of an app item.
Parameters
user: TUser
Returns Promise<void>
unsubscribe
The method allows you to unsubscribe a user from updates in the activity stream of an app item.
Parameters
user: TUser
Returns Promise<void>
uploadSign
The method uploads a digital signature.
The method is used to create a custom signing mechanism for apps. You can use it to apply a signature obtained from an external signature provider to an app. To use this method, you need:
document1
is a Document type app in the context.MySignProvider
class is an example signature provider. The method returns a flag that indicates the status of the upload. If the flag evaluates totrue
, the upload of the signature is successful;false
means that the upload failed.const app = await Context.data.document1. fetch(); const provider = new MySignProvider(); const innerSigns = await Conetxt.data.document1.getDataSigns(); const attributesInnerSign = innerSigns.find(sign => sign.type === SignType.Attributes); const sign = provider.Sign(attributesInnerSign.body); const newSign: NewSign = { sign: sign, codeProvider: 'MyProvider', body: attributesInnerSign.body, signType: SignType.Attributes, hash: attributesInnerSign.hash, }; const isUploaded = await app. uploadSign(newSign);
Parameters
sign: NewSign
Returns Promise<boolean>
Properties
Methods