Reference objects are usually used in App type properties in order to avoid loading all the associated data. To read the entire app item data, call method ApplicationProjectItemRef.fetch , and to get the entire item object, call ApplicationProjectItem.

const  my_app_full = await Context.data.my_app.fetch();

Type parameters

Hierarchy

Properties

Readonly code

code: string

App code of the URL’s target (the app’s code).

Readonly id

id: string

ID of the URL’s target.

Readonly namespace

namespace: string

Namespace of the URL target (the code of the workspace that the app belongs to).

Methods

createDraft

  • createDraft(payload?: ProjectPlanStructure): Promise<ProjectDraftStructure>
  • The method allows creating a new empty draft or a draft based on a project plan.

    const plan = await project.getCurrentPlan();
    const newDraft  = await createDraft(plan); 
    

    Parameters

    • Optional payload: ProjectPlanStructure

      project plan structure.

    Returns Promise<ProjectDraftStructure>

delete

  • delete(): Promise<void>
  • 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

getCurrentPlan

  • getCurrentPlan(): Promise<ProjectPlanStructure | undefined>
  • The method allows getting the current project plan.

    const plan = await project.getCurrentPlan();
    

    Returns Promise<ProjectPlanStructure | undefined>

getDraft

  • getDraft(): Promise<ProjectDraftStructure | undefined>
  • The method allows getting the project draft.

    const draft = await project.getDraft();
    

    Returns Promise<ProjectDraftStructure | undefined>

getFolder

  • getFolder(): Promise<TFolder | undefined>
  • 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>

getPlanByVersion

  • getPlanByVersion(version: number): Promise<ProjectPlanStructure | undefined>
  • The method allows getting the project plan by its version.

    const plan = await project.getPlanByVersion();
    

    Parameters

    • version: number

      project plan version.

    Returns Promise<ProjectPlanStructure | undefined>

getRegistrations

  • Deprecated. Get a list of registrations of an app item.

    const item = Context.data.d1!
    await item.getRegistrations(); 
    
    deprecated

    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>

manualRegister

  • manualRegister(nameReg: string, nomenclatureId: string): Promise<boolean>
  • Deprecated. Manual registration of an app item (if manual registration is enabled in the folder’s settings).

    deprecated

    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>

register

  • register(nomenclatureId: string): Promise<boolean>
  • Deprecated. Automatic app item registration.

    deprecated

    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

  • restore(): Promise<void>
  • The method allows you to restore a deleted app item.

    await Context.data.app.restore();
    

    Returns Promise<void>

sendMessage

  • sendMessage(title: string, message: string): Promise<void>
  • The method allows sending messages to an app item’s activity stream.

    Parameters

    • title: string

      Message subject.

    • message: string

      Message body.

      await Context.data.request.sendMessage('The  work on your request has been completed', `Solution: ${Context.data.result}`)
      

    Returns Promise<void>

setFolder

  • setFolder(id: string): Promise<void>
  • The allows you to change the app item’s folder in the Folder hierarchy.

    Parameters

    • id: string

      Folder ID.

      const item = await Context.data.n1;
      await item. setFolder('00000-00000-00000-00000'); 
      

    Returns Promise<void>