Skip to end of metadata
Go to start of metadata


  • refreshDocuments (from version 3.2.59) - refreshes the documents on the form without reloading the page. The document table in the Documents tab, the number of documents in the title of the Documents tab and the document view are refreshed.
    • Function parameters: none
    • Function result: none
  • registerHook (from version 3.2.104) - allows you to pin in a document management moment and perform some action.
    • Function parameters

      NameType

      Default value

      DescriptionExample
      hookObjectnullDefined hooks to be called: - refresh (Function Type) Function that will be called after refreshing all elements related to document display. Refresh always occurs after document operations such as add, delete, modify.
      var hookId = DocumentService.registerHook({
          refresh: function() {
             PW.ui.Message.success( 'Dokumenty odświeżone' );
          }
      });


    • Function result: automatically generated hook id. Necessary for deregistering the hook.

  • unregisterHook (from version 3.2.104) - allows you to deregister a hook based on its id received during registration.
    • Function parameters

      NameType

      Default value

      Description
      idNumber Id received from the function that registers the hook.
  • changeShownDocument (from version 3.2.107) - allows you to change the displayed document on the form. This document must be available for display by mouse click. If it is not (e.g., because the user has specified too few displayed documents on the form in the account settings), an error will be displayed in the browser logs.
    • Function parameters

      NameType

      Default value

      Description
      idNumber Id of the document to be displayed.
  • getAttachedDocuments (from version 4.0.16) - downloads a list of documents connected to the process.
    • Function parameters

      Default value

      NameType

      Default value

      Description
      processIdString Id of the process from which the connected documents are to be downloaded.
    • Function result:

      NameTypeDescriptionExample
      documentsAttachedToProcessPromiseThe Promise object represents the possible completion (or failure) of an asynchronous operation to call a query retrieving a list of documents connected to the process. If successful, a list of objects with the following fields will be returned:

      - processId - id of the process

      - documentId - document id

      - documentName - name of the document

      - documentDescription - description of the document

      - documentClassId - id of the document class

      - indices - list of indexes of the document (in case of lack of permission to view, null is returned)

      - documentDate - document date

      - fileIds - list of all document versions

      - owner - owner of the document

      Calling the method of the service with the expectation of the result:

      foo: async function() {
      	let documentsAttachedToProcess = await DocumentService.getAttachedDocuments('id_procesu')
      		.catch(error => failureFn(error));
      	console.log(documentsAttachedToProcess[0].documentId);
      }

      Asynchronous service method call without waiting for the result:

      foo: function() {
      	let documentsAttachedToProcess = DocumentService.getAttachedDocuments('id_procesu')
      		.then(result => successFn(result))
      		.catch(error => failureFn(error));
      	console.log('bar'); // code will trigger without waiting for the result from the called service method to be served
      }
 

 

  • No labels