Hierarchy
- DocflowApplicationItemRef
Methods
changeRegistration
-
The method changes the registration number of an app item after registration.
Example of changing the registration number in the first registration folder of an app item of the Document type:
const item = Context.data.d1! const registrations = await item.docflow(). getRegistrations() if (registrations.length <= 0) { throw new Error( 'something gone wrong'); } await item.docflow(). changeRegistration(registrations[0].nomenclatureId, 'number1');
Parameters
-
nomenclatureId: string
folder number.
-
numberRegistration: string
new registration number.
Returns Promise<void>
-
deleteRegistration
-
The method deletes an app item’s registration.
Example of deleting registration in all folders for an item of a Document type app:
const item = Context.data.d1! const settings = await Application.getSettings(); settings.registrationSettings. nomenclatureIds.forEach(nomenclatureId => { item.docflow(). deleteRegistration(nomenclatureId); })
Parameters
-
nomenclatureId: string
Folder number.
Returns Promise<boolean>
Deletion result.
-
deleteReservation
-
The method cancels the reservation of a registration number in a specific folder for an item of a Document type app.
Example of canceling the reservation of a registration number for an app item:
const item = Context.data.d1! const settings = await Application.getSettings(); const nomenclatures = []; for (const nomenclatureId of settings.registrationSettings.nomenclatureIds) { const nomenclature = await item.docflow().getNomenclature(nomenclatureId); if (nomenclature !== undefined) { nomenclatures. push(nomenclature); } } const nomenclatureName = 'Folder name' const nomenclatureForReservation = nomenclatures.find(nom => nom.name === nomenclatureName); if (nomenclatureForReservation !== undefined) { await item.docflow().deleteReservation(nomenclatureForReservation.__id); }
Parameters
-
nomenclatureId: string
Folder number.
Returns Promise<void>
-
getApprovalArchivedLists
-
The method loads archived approval sheets.
const item = await Context.data.n1; const approvalLists = await item.docflow().getApprovalArchivedLists();
Returns Promise<BaseList[]>
Archived approval sheets.
getApprovalLists
-
The method loads active approval sheets.
const item = await Context.data.n1; const approvalLists = await item.docflow().getApprovalLists();
Returns Promise<BaseList[]>
Active approval sheets.
getInformArchivedLists
-
The method loads archived lists of informed users.
const item = await Context.data.n1; const approvalLists = await item.docflow().getInformArchivedLists();
Returns Promise<BaseList[]>
Archived lists of informed users.
getInformLists
-
The method loads active lists of informed users.
const item = await Context.data.n1; const approvalLists = await item.docflow().getInformLists();
Returns Promise<BaseList[]>
Active lists of informed users.
getNomenclature
-
The method gets a folder by its number.
Example of getting a folder where an item of a Document type app is registered:
const item = Context.data.d1! const settings = await Application.getSettings(); const nomenclatures = []; for (const nomenclatureId of settings.registrationSettings.nomenclatureIds) { const nomenclature = await item.docflow().getNomenclature(nomenclatureId); if (nomenclature !== undefined) { nomenclatures. push(nomenclature); } }
Parameters
-
nomenclatureId: string
Folder number.
Returns Promise<TNomenclature | undefined>
Folder (if found).
-
getRegistrations
-
The method gets the list of registrations for an item of a Document type app.
const item = Context.data.d1! await item.docflow(). getRegistrations();
Returns Promise<ApplicationItemRegistration[]>
List of an app item’s registrations.
getReserved
-
The method gets the number that was earlier reserved for an app item of the Document type in a specific folder.
Example of getting a reserved number for an app item:
const item = Context.data.d1 if (item) { const settings = await Application. getSettings() const nomenclatures: TNomenclature[] = []; for ( const nomenclatureId of settings.registrationSettings.nomenclatureIds) { const nomenclature = await item.docflow(). getNomenclature(nomenclatureId) if (nomenclature !== undefined) { nomenclatures.push(nomenclature) } } const nomenclatureName = 'Folder name' const nomenclatureForReservation = nomenclatures.find(nom => nom.__name === nomenclatureName) if ( nomenclatureForReservation !== undefined) { const reservedNumber = await item.docflow().getReserved(nomenclatureForReservation.__id) Context.data.reservedNumber = reservedNumber } }
Parameters
-
nomenclatureId: string
Folder number.
Returns Promise<string>
Reserved number.
-
manualRegister
-
The method manually registers an item of a Document type app.
To be able to use this method, you need to enable manual registration in the folder’s settings. If the
dateRegistry
parameter is missing, the current date will be used for registration. Example of manual registration of all app items in folders that registration is enabled in for this app:const item = Context.data.d1! const settings = await Application .getSettings(); settings.registrationSettings.nomenclatureIds.forEach( nomenclatureId => { item.docflow().manualRegister('Номер тест 1', nomenclatureId, new Datetime('2021-01-20')); })
Parameters
-
nameReg: string
Registration number.
-
nomenclatureId: string
Folder number.
-
Optional dateRegistry: TDatetime
Registration date (optional parameter).
Returns Promise<boolean>
Registration result.
-
register
-
The method automatically registers an item of a Document type app.
The registration number will be generated automatically according to the template set in the folder’s settings. Example of automatic registration of an item in all folders available for the app:
const item = Context.data.d1! const settings = await Application.getSettings(); settings .registrationSettings.nomenclatureIds.forEach(nomenclatureId => { item. docflow().register(nomenclatureId); })
Parameters
-
nomenclatureId: string
Folder number.
Returns Promise<boolean>
Registration result.
-
reserve
-
The method reserves a registration number in a specific folder for an item of a Document type app.
The folder’s number is generated automatically based on the template in the document categorization settings. Example of reserving a registration number for an app item in a specific folder:
const item = Context.data.d1! const settings = await Application.getSettings(); const nomenclatures = []; for (const nomenclatureId of settings. registrationSettings.nomenclatureIds) { const nomenclature = await item. docflow().getNomenclature(nomenclatureId); if (nomenclature !== undefined) { nomenclatures.push(nomenclature); } } const nomenclatureName = 'Folder name'; const nomenclatureForReservation = nomenclatures.find(nom => nom.name === nomenclatureName); if ( nomenclatureForReservation !== undefined) { const reservedNumber = await item.docflow().reserve(nomenclatureForReservation.__id); }
Parameters
-
nomenclatureId: string
Folder number.
Returns Promise<string>
Reserved number.
-
unarchiveApprovalList
-
The method unarchives an approval sheet and makes it active.
Example of activating all archived sheets:
const item = await Context.data.n1; const approvalLists = await item.docflow(). getApprovalArchivedLists(); approvalLists.forEach(list => item.docflow(). unarchiveApprovalList(list.__id))
Parameters
-
listId: string
Sheet number.
Returns Promise<void>
-
Object to work with registrations and lists/sheets associated with the item