|
DOCUMENTS 5 - PortalScripting API
|
The DocFile class implements the file object of DOCUMENTS. More...
Public Member Functions | |
| boolean | abort () |
| Cancel edit mode for a file. More... | |
| Document | addDocumentFromFileSystem (String pathDocument, String targetRegister, String targetFileName, boolean deleteDocumentAtFileSystem=false, boolean parseAutoText=false, DocFile referencFileToParse=this) |
| Add a file as a new Document from the server's filesystem to a given Register. More... | |
| boolean | addPDF (String pathCoverXML, boolean createCover, String pdfFileName, String targetRegister, Array sourceRegisterNames) |
| Create a PDF file containing the current DocFile's contents and store it on a given document register. More... | |
| boolean | archive () |
| Archive the DocFile object. More... | |
| boolean | archive (String archiveKey) |
| Archive the DocFile object to the desired archive. More... | |
| boolean | archive (ArchivingDescription desc) |
| Archive the DocFile object according to the given ArchivingDescription object. More... | |
| boolean | archiveAndDelete () |
| Archive the DocFile object and remove the DOCUMENTS file. More... | |
| String | asJSON (string[] fieldList=[]) |
| Creates a JSON-String of this file. More... | |
| boolean | cancelWorkflow () |
| Cancel the current workflow for the file. More... | |
| boolean | changeFiletype (String nameFiletype) |
| Change the filetype of this file. More... | |
| boolean | checkWorkflowReceiveSignal () |
| Checks the receive signals of the workflow for the DocFile object. More... | |
| boolean | clearFollowUpDate (SystemUser pUser) |
| Clear a followup date for a desired user. More... | |
| boolean | commit () |
| Commit any changes to the DocFile object. More... | |
| boolean | connectFolder (Folder fObj) |
| Store a reference to the current file in the desired target folder. More... | |
| int | countFields (String fieldName) |
| Count fields with a desired name in the file. More... | |
| String | createMonitorFile (boolean asPDF=false, String locale="") |
| Creates a workflow monitor file in the server's file system. More... | |
| String | createStatusFile (boolean asPDF=false, String locale="") |
| Creates a status file in the server's file system. More... | |
| boolean | deleteFile (boolean moveTrash=false, boolean movePool=true, boolean allVersions=false, integer easDeleteMode=0) |
| Delete the DocFile object. More... | |
| boolean | disconnectArchivedFile () |
| Uncouple an active file from the archived version. More... | |
| boolean | disconnectFolder (Folder fObj) |
| Remove a reference to the current file out of the desired target folder. More... | |
| boolean | exportXML (String pathXML, boolean withDocuments, boolean withStatus=false, boolean withMonitor=false) |
| Export the file as an XML file. More... | |
| boolean | forwardFile (String controlFlowId, String comment="") |
| Forward file in its workflow via the given control flow. More... | |
| boolean | fromJSON (String jsonstring) |
| Updates a file from a JSON-String. More... | |
| WorkflowStepIterator | getAllLockingWorkflowSteps () |
| Get a list of all locking workflow step that currently lock the file. More... | |
| WorkflowStepIterator | getAllWorkflowSteps () |
| Get a list of all workflow step of the file. More... | |
| String | getArchiveKey (boolean withServer=true) |
| After archiving of a file this method returns the key of the file in the archive. More... | |
| String | getAsPDF (String nameCoverTemplate, boolean createCover, Array sourceRegisterNames) |
| Create a PDF file containing the current DocFile's contents and returns the path in the file system. More... | |
| String | getAttribute (String attribute) |
| Get the String value of an attribute of the file. More... | |
| String | getAutoText (String autoText) |
| Get the String value of a DOCUMENTS autotext. More... | |
| DocFile | getCopy ("NoDocs"|"ActualVersion"|"AllVersions" copyMode) |
| Duplicate a file. More... | |
| Date | getCreationDate () |
| Returns the creation date (timestamp) of a DocFile. More... | |
| var | getCreator (boolean asObject=false) |
Returns the SystemUser object or fullname as String of the creator of the DocFile. More... | |
| WorkflowStep | getCurrentWorkflowStep () |
| Get the current workflow step of the current user locking the file. More... | |
| DocFileDataField | getDocFileComment () |
| Returns the comment value for a DocFile. More... | |
| string [] | getDoubleSelectListValues (String fieldName, boolean resolved=false) |
| Get the enumeration values of the desired double select list field. More... | |
| Array | getEnumAutoText (String autoText) |
| Get an array with the values of an enumeration autotext. More... | |
| String | getFieldAttribute (String fieldName, String attrName) |
| Get the String value of an attribute of the desired file field. More... | |
| String | getFieldAutoText (String fieldName, String autoText="") |
| Returns an AutoText value of a specified field of the DocFile. More... | |
| String | getFieldName (int index) |
| Get the technical name of the n-th field of the file. More... | |
| var | getFieldValue (String fieldName, String returnType) |
| Get the value of the desired file field. More... | |
| SystemUser | getFileOwner () |
| Get the file owner of the file. More... | |
| WorkflowStep | getFirstLockingWorkflowStep () |
| Get the first locking workflow step that currently locks the file. More... | |
| String | getid () |
| Returns the file id of the DocFile. More... | |
| String | getLastError () |
| Function to get the description of the last error that occurred. More... | |
| Date | getLastModificationDate () |
| Returns the last modification date (timestamp) of a DocFile. More... | |
| String | getLastModifier () |
Returns the fullname as String of the last editor of the DocFile. More... | |
| String | getOID (boolean oidLow=false) |
| Returns the object-id. More... | |
| DocFile | getOriginal () |
| Get the orginal file for a scratch copy. More... | |
| DocFile | getReferenceFile (String referenceFileField) |
| Get the file referred by a reference field in the current file. More... | |
| Register | getRegisterByName (String registerName, boolean checkAccessRight=false) |
| RegisterIterator | getRegisters (String type="documents", boolean checkAccessRight=false) |
| Get an iterator with the registers of the file for the specified type. More... | |
| String | getTitle (String locale=user locale) |
| Returns the title of the DocFile. More... | |
| String | getUserStatus (String login) |
| Get the status of the file for a desired user. More... | |
| boolean | hasField (String fieldName) |
| Gather information whether the current file has the field with the desired name. More... | |
| boolean | insertStatusEntry (String action, String comment) |
| Add an entry to the status tab of the file. More... | |
| boolean | isArchiveFile () |
| Gather information whether the current file is an archive file. More... | |
| boolean | isDeletedFile () |
| Gather information whether the current file is a deleted file of a trash folder. More... | |
| boolean | isNewFile () |
| Gather information whether the current file is a new file. More... | |
| boolean | reactivate () |
| Reactivate an archive file to a file of the corresponding filetype. More... | |
| boolean | sendFileAdHoc (Array receivers, String sendMode, String task, boolean backWhenFinished) |
| Send the DocFile directly. More... | |
| boolean | sendMail (String from, String templateName, String to, String cc, boolean addDocs, String bcc) |
| Send the file as email to somebody. More... | |
| boolean | setAttribute (String attribute, String value) |
| Set the String value of an attribute of the file to the desired value. More... | |
| boolean | setFieldAttribute (String fieldName, String attrName, String value) |
| Set the value of an attribute of the desired file field. More... | |
| boolean | setFieldValue (String fieldName, var value) |
| Set the value of the desired file field. More... | |
| boolean | setFileOwner (SystemUser owner) |
| Set the file owner of the file to the desired user. More... | |
| boolean | setFollowUpDate (SystemUser pUser, Date followUpDate, String comment) |
| Set a followup date for a desired user. More... | |
| DocFile | setReferenceFile (String fieldName, DocFile referenceFile) |
| set the referred file of the desired reference field in the current file. More... | |
| boolean | setUserRead (String login, boolean fileRead) |
| Mark the file as read or unread for the desired user. More... | |
| boolean | setUserStatus (String login, String status) |
| Set the status of the file for a desired user to a desired value. More... | |
| boolean | startEdit () |
| Switch a DocFile to edit mode. More... | |
| boolean | startWorkflow (String workflowName) |
| Start a workflow for the DocFile object. More... | |
| boolean | sync (boolean checkHistoryFields=false, boolean notifyHitlistChange=true, boolean updateRefFields=true, boolean updateModifiedDate=false) |
| Synchronize any changes to the DocFile object back to the real file. More... | |
| boolean | undeleteFile () |
| Relive a deleted file. More... | |
Public Attributes | |
| var | fieldName |
| The technical name of a field. More... | |
The DocFile class implements the file object of DOCUMENTS.
You may access a single DocFile with the help of the attribute context.file or by creating a FileResultset. There are no special properties available, but each field of a file is mapped to an according property. You can access the different field values with their technical names.
For this reason it is mandatory to use programming language friendly technical names, meaning
| boolean DocFile::abort | ( | ) |
Cancel edit mode for a file.
If you switched a file to edit mode with the startEdit() method and if you want to cancel this (e.g. due to some error that has occurred in the mean time) this function should be used to destroy the scratch copy which has been created by the startEdit() instruction.
true if successful, false in case of any error | Document DocFile::addDocumentFromFileSystem | ( | String | pathDocument, |
| String | targetRegister, | ||
| String | targetFileName, | ||
| boolean | deleteDocumentAtFileSystem = false, |
||
| boolean | parseAutoText = false, |
||
| DocFile | referencFileToParse = this |
||
| ) |
Add a file as a new Document from the server's filesystem to a given Register.
It is possible to parse Autotexts inside the source file to fill the Document with the contents of index fields of a DocFile object. The max. file size for the source file is 512 KB.
| pathDocument | String value containing the complete filepath to the source file on the server |
| targetRegister | String value containing the technical name of the desired Register |
| targetFileName | String value containing the desired filename of the uploaded Document |
| deleteDocumentAtFileSystem | optional boolean value to decide whether to delete the source file on the server's filesystem |
| parseAutoText | optional boolean value to decide whether to parse the AutoText values inside the source file. Note: if you want to make use of AutoTexts in this kind of template files, you need to use double percentage signs instead of single ones, e.g. %%Field1%% instead of %Field1%! |
| referencFileToParse | optional DocFile object to be used to parse the AutoTexts inside the template. If you omit this parameter, the current DocFile object is used as the data source. |
Document if successful, null in case of any error | boolean DocFile::addPDF | ( | String | pathCoverXML, |
| boolean | createCover, | ||
| String | pdfFileName, | ||
| String | targetRegister, | ||
| Array | sourceRegisterNames | ||
| ) |
Create a PDF file containing the current DocFile's contents and store it on a given document register.
The different document types of your documents on your different tabs require the appropriate PDF filter programs to be installed and configured in DOCUMENTS. To successfully add the created PDF file to a register the DocFile needs to be in edit mode (via startEdit() method), and the changes have to be applied via commit().
| pathCoverXML | String containing full path and filename of the template xml file to parse |
| createCover | boolean whether to create a field list or to only take the documents |
| pdfFileName | String value for the desired file name of the created PDF |
| targetRegister | String value containing the technical name of the target document register |
| sourceRegisterNames | Array with the technical names of the document registers you want to include |
true if successful, false in case of any error | boolean DocFile::archive | ( | ) |
Archive the DocFile object.
The target archive has to be configured in the filetype definition (in the Windows Portal Client) as the default archive. If no default archive is defined, the execution of this operation will fail.
true if successful, false in case of any error | boolean DocFile::archive | ( | String | archiveKey | ) |
Archive the DocFile object to the desired archive.
If the target archive key is misspelled or if the target archive does not exist, the operation will fall back to the default archive, as long as it is configured in the filetype definition. So the function will only fail if both the target archive and the default archive are missing.
| archiveKey | String value containing the complete archive key for EE.i or schema|view for EE.x of the desired target archive |
true if successful, false in case of any error | boolean DocFile::archive | ( | ArchivingDescription | desc | ) |
Archive the DocFile object according to the given ArchivingDescription object.
This is the most powerful way to archive a file through scripting, since the ArchivingDescription object supports a convenient way to influence which parts of the DocFile should be archived.
| desc | ArchivingDescription object that configures several archiving options |
true if successful, false in case of any error | boolean DocFile::archiveAndDelete | ( | ) |
Archive the DocFile object and remove the DOCUMENTS file.
The target archive has to be configured in the filetype definition (in the Windows Portal Client) as the default archive. It depends on the filetype settings as well, whether Status and Monitor will be archived as well. If no default archive is defined, the execution of this operation will fail.
true if successful, false in case of any error | String DocFile::asJSON | ( | string [] | fieldList = [] | ) |
Creates a JSON-String of this file.
| fieldList | optional String array, that specifies the DocFile attributes and field names, that will be part of JSON export |
Available DocFile attributes:
"DlcFile_Title" "DlcFile_Owner" "DlcFile_Created" "DlcFile_LastEditor" "DlcFile_LastModified" String with JSON content. fieldList)| boolean DocFile::cancelWorkflow | ( | ) |
Cancel the current workflow for the file.
true if successful, false in case of any error | boolean DocFile::changeFiletype | ( | String | nameFiletype | ) |
Change the filetype of this file.
| nameFiletype | String containing the technical name of the filetype. |
true if successful, false in case of any error. | boolean DocFile::checkWorkflowReceiveSignal | ( | ) |
Checks the receive signals of the workflow for the DocFile object.
This method can only be used for a DocFile, that runs in a workflow and the workflow has receive signals. Usually the receive signals of the workflow step will be checked by a periodic job. Use this method to trigger the check of the receive signals for the DocFile.
true if successful, false in case of any error | boolean DocFile::clearFollowUpDate | ( | SystemUser | pUser | ) |
Clear a followup date for a desired user.
| pUser | SystemUser object of the desired user |
true if successful, false in case of any error | boolean DocFile::commit | ( | ) |
Commit any changes to the DocFile object.
This method is mandatory to apply changes to a file that has been switched to edit mode with the startEdit() method. It is strictly prohibited to execute the commit() method in a script which is attached to the onSave scripting hook.
true if successful, false in case of any error | boolean DocFile::connectFolder | ( | Folder | fObj | ) |
Store a reference to the current file in the desired target folder.
The (public) folder must be a real folder, it must not be a dynamic filter, nor a "only subfolder" object.
| fObj | Folder object representing the desired target public folder |
true if successful, false in case of any error. | int DocFile::countFields | ( | String | fieldName | ) |
Count fields with a desired name in the file.
| fieldName | String containing the technical name of the fields to be counted. |
| String DocFile::createMonitorFile | ( | boolean | asPDF = false, |
| String | locale = "" |
||
| ) |
Creates a workflow monitor file in the server's file system.
This method creates a monitor file in the server's file system with the workflow monitor content of the DocFile. The file will be created as a html-file.
| asPDF | boolean parameter that indicates that a pdf-file must be created instead of a html-file |
| locale | String (de, en,..) in which locale the file must be created (empty locale = log-in locale) |
| String DocFile::createStatusFile | ( | boolean | asPDF = false, |
| String | locale = "" |
||
| ) |
Creates a status file in the server's file system.
This method creates a status file in the server's file system with the status content of the DocFile. The file will be created as a html-file.
| asPDF | boolean parameter that indicates that a pdf-file must ge created instead of a html-file |
| locale | String (de, en,..) in which locale the file must be created (empty locale = log-in locale) |
| boolean DocFile::deleteFile | ( | boolean | moveTrash = false, |
| boolean | movePool = true, |
||
| boolean | allVersions = false, |
||
| integer | easDeleteMode = 0 |
||
| ) |
Delete the DocFile object.
If there's another PortalScript attached to the onDelete scripting hook, it will be executed right before the deletion takes place.
| moveTrash | optional boolean parameter to decide whether to move the deleted file to the trash folder |
| movePool | optional boolean parameter to decide whether to move the deleted file's object to the file pool |
| allVersions | optional boolean parameter to delete all versions of an EAS archive file at once. |
| easDeleteMode | opional integer specifying the delete mode for an EAS archive file. See remarks. |
true if successful, false in case of any error | boolean DocFile::disconnectArchivedFile | ( | ) |
Uncouple an active file from the archived version.
true if successful, false in case of any error. | boolean DocFile::disconnectFolder | ( | Folder | fObj | ) |
Remove a reference to the current file out of the desired target folder.
The (public) folder must be a real folder, it must not be a dynamic filter, nor a "only subfolder" object.
| fObj | Folder object representing the desired target public folder |
true if successful, false in case of any error. | boolean DocFile::exportXML | ( | String | pathXML, |
| boolean | withDocuments, | ||
| boolean | withStatus = false, |
||
| boolean | withMonitor = false |
||
| ) |
Export the file as an XML file.
| pathXML | String containing full path and filename of the desired target xml file |
| withDocuments | boolean value to include the documents. The value must be set to true in case status or monitor information are to be inserted. |
| withStatus | boolean value to include status information. The value must be set to true in order to add the status. Status Information will then be generated into a file which will be added to the documents. Please note that therefore withDocuments must be set to true in order to get Status information. |
| withMonitor | boolean value to include Monitor information. The value must be set to true in order to add the monitor. Monitor Information will then be generated into a file which will be added to the documents. Please note that therefore withDocuments must be set to true in order to get Monitor information. |
true if successful, false in case of any error | boolean DocFile::forwardFile | ( | String | controlFlowId, |
| String | comment = "" |
||
| ) |
Forward file in its workflow via the given control flow.
This method only works if the file is inside a workflow and inside a workflow action that is accessible by a user of the web interface. Based on that current workflowstep you need to gather the ID of one of the outgoing control flows of that step. The access privileges of the current user who tries to execute the script are taken into account. Forwarding the file will only work if that control flow is designed to forward without query.
| controlFlowId | String containing the technical ID of the outgoing control flow that should be passed |
| comment | optional String value containing a comment to be automatically added to the file's monitor |
true if successful, false in case of any error | boolean DocFile::fromJSON | ( | String | jsonstring | ) |
Updates a file from a JSON-String.
Must be followed by sync()
true if successful, false in case of any error. | WorkflowStepIterator DocFile::getAllLockingWorkflowSteps | ( | ) |
Get a list of all locking workflow step that currently lock the file.
The locking workflow steps do not need to be locked by the current user executing the script, this function as well returns all locking steps which refer to different users.
| WorkflowStepIterator DocFile::getAllWorkflowSteps | ( | ) |
Get a list of all workflow step of the file.
The methd will return all workflow steps, the currently locking and the previous ones.
| String DocFile::getArchiveKey | ( | boolean | withServer = true | ) |
After archiving of a file this method returns the key of the file in the archive.
| withServer | optional boolean value to indicate, if the key should include an "@archiveServerName" appendix |
| String DocFile::getAsPDF | ( | String | nameCoverTemplate, |
| boolean | createCover, | ||
| Array | sourceRegisterNames | ||
| ) |
Create a PDF file containing the current DocFile's contents and returns the path in the file system.
The different document types of your documents on your different tabs require the appropriate PDF filter programs to be installed and configured in DOCUMENTS.
| nameCoverTemplate | String containing the name of the pdf cover template defined at the filetype |
| createCover | boolean whether to create a field list or to only take the documents |
| sourceRegisterNames | Array with the technical names of the document registers you want to include |
String with file path of the pdf, an empty string in case of any error | String DocFile::getAttribute | ( | String | attribute | ) |
Get the String value of an attribute of the file.
| attribute | String containing the name of the desired attribute |
| String DocFile::getAutoText | ( | String | autoText | ) |
Get the String value of a DOCUMENTS autotext.
| autoText | the rule to be parsed |
| DocFile DocFile::getCopy | ( | "NoDocs"|"ActualVersion"|"AllVersions" | copyMode | ) |
Duplicate a file.
This function creates a real 1:1 copy of the current file which may be submitted to its own workflow. The function returns the copied file. If an error occurrs, the function returns null and getLastError() can be called on the calling object.
| copyMode | defines how to handle the documents of the originating file. There are three different parameter values allowed: |
| Date DocFile::getCreationDate | ( | ) |
Returns the creation date (timestamp) of a DocFile.
Date object, if the date is valid, null for an invalid data. | var DocFile::getCreator | ( | boolean | asObject = false | ) |
Returns the SystemUser object or fullname as String of the creator of the DocFile.
| asObject | optional boolean value, that specifies, if the SystemUser object or the fullname should be returned. |
asObject=true: SystemUser object or null (if user does not exist anymore) asObject=false: String with the fullname. | WorkflowStep DocFile::getCurrentWorkflowStep | ( | ) |
Get the current workflow step of the current user locking the file.
The function returns a valid WorkflowStep object if there exists one for the current user. If the current user does not lock the file, the function returns null instead.
| DocFileDataField DocFile::getDocFileComment | ( | ) |
Returns the comment value for a DocFile.
DocFileDataField object or null. | string [] DocFile::getDoubleSelectListValues | ( | String | fieldName, |
| boolean | resolved = false |
||
| ) |
Get the enumeration values of the desired double select list field.
| fieldName | String containing the technical field name can be followed by the desired instance number in form techFieldName[i] for multi-instance fields of an EE.i/EE.x archive file. Note: The index i is zero-based. The specification of field instance is olny available for an EE.i/EE.x archive file, it will be ignored for other files. If the parameter contains no instance information, the first field instance is used. The field instance order is determined by the field order in the file. |
| resolved | Optional boolean value indicating whether to return the full multi language enumeration values (e.g. "key;de:Wert;en:Value") instead of only the keys (e.g. "key"). The default value is false. |
| Array DocFile::getEnumAutoText | ( | String | autoText | ) |
Get an array with the values of an enumeration autotext.
| autoText | to be parsed |
| String DocFile::getFieldAttribute | ( | String | fieldName, |
| String | attrName | ||
| ) |
Get the String value of an attribute of the desired file field.
| fieldName | String containing the technical name of the desired field |
| attrName | String containing the name of the desired attribute |
| String DocFile::getFieldAutoText | ( | String | fieldName, |
| String | autoText = "" |
||
| ) |
Returns an AutoText value of a specified field of the DocFile.
The following AutoTexts are available
"[locale]" - field value in the user locale or specified locale. "key" - key value (e.g. at refence fields, enumeration fields, etc.). "fix" - fix format value (e.g. at numeric fields, date fields, etc.). "pos" - order position of the field value at enumeration fields. "raw" - database field value. "label[.locale]" - label of the field in user locale or specified locale.| fieldName | Name of the field as String |
| [autoText] | WantedAutoText as String (default = "" returns field value in the user locale) |
String with the AutoText. | String DocFile::getFieldName | ( | int | index | ) |
Get the technical name of the n-th field of the file.
This allows generic scripts to be capable of different versions of the same filetype, e.g. if you changed details of the filetype, but there are still older files of the filetype in the system.
| index | integer index of the desired field |
false if index is out of range | var DocFile::getFieldValue | ( | String | fieldName, |
| String | returnType | ||
| ) |
Get the value of the desired file field.
| fieldName | String containing the technical field name can be followed by the desired instance number in form techFieldName[i] for multi-instance fields of an EE.i/EE.x archive file. Note: The index i is zero-based. The specification of field instance is olny available for an EE.i/EE.x archive file, it will be ignored for other files. If the parameter contains no instance information, the first field instance is used. The field instance order is determined by the field order in the file. |
| returnType | Optional string specified the type of the return value. Currently only the type "Array" is available for a double select list field. |
returnType)| SystemUser DocFile::getFileOwner | ( | ) |
Get the file owner of the file.
| WorkflowStep DocFile::getFirstLockingWorkflowStep | ( | ) |
Get the first locking workflow step that currently locks the file.
The first locking workflow step does not need to be locked by the current user executing the script, this function as well returns the first locking step if it is locked by a different user. If no locking step is found at all, the function returns null instead.
| String DocFile::getid | ( | ) |
Returns the file id of the DocFile.
String with the file id. | String DocFile::getLastError | ( | ) |
Function to get the description of the last error that occurred.
| Date DocFile::getLastModificationDate | ( | ) |
Returns the last modification date (timestamp) of a DocFile.
Date object, if the date is valid, null for an invalid data. | String DocFile::getLastModifier | ( | ) |
Returns the fullname as String of the last editor of the DocFile.
String with the fullname. | String DocFile::getOID | ( | boolean | oidLow = false | ) |
Returns the object-id.
| oidLow | Optional flag: If true only the id of the DocFile object (m_oid) will be returned. If false the id of the DocFile object will be returned together with the id of the corresponding class in the form class-id:m_oid. The default value is false. |
String with the object-id oidLow) | DocFile DocFile::getOriginal | ( | ) |
Get the orginal file for a scratch copy.
If you run a scipt on a scratch copy (e.g. a onSave script), you can get the orginal file with this function.
| DocFile DocFile::getReferenceFile | ( | String | referenceFileField | ) |
Get the file referred by a reference field in the current file.
If the current file's filetype is connected to a superior filetype by a reference field, this function allows to easily access the referred file, e.g. if you are in an invoice file and you want to access data of the referring company.
| referenceFileField | String value containing the technical name of the file field contianing the definition to the referred filetype |
null in case of any error | Register DocFile::getRegisterByName | ( | String | registerName, |
| boolean | checkAccessRight = false |
||
| ) |
| registerName | String value containing the technical name of the desired register |
| checkAccessRight | optional boolean value, that indicates if the access rights should be considered. |
checkAccessRight) checkAccessRight this can now be done. For backward compatibility the default value is set to false.| RegisterIterator DocFile::getRegisters | ( | String | type = "documents", |
| boolean | checkAccessRight = false |
||
| ) |
Get an iterator with the registers of the file for the specified type.
| type | optional String value to filter for a desired register type. Default type is documents Allowed values:
|
| checkAccessRight | optional boolean value, that indicates if the access rights should be considered. |
checkAccessRight) checkAccessRight this can now be done. For backward compatibility the default value is set to false.| String DocFile::getTitle | ( | String | locale = user locale | ) |
Returns the title of the DocFile.
| [locale] | Locale as String (default = user locale) |
String with the title. raw returns the title in all locales| String DocFile::getUserStatus | ( | String | login | ) |
Get the status of the file for a desired user.
| login | String containing the login name of the desired user |
standard new fromFollowup toForward forInfo task workflowCanceled backFromDistribution consultation | boolean DocFile::hasField | ( | String | fieldName | ) |
Gather information whether the current file has the field with the desired name.
| fieldName | String containing the technical name of the field. |
true if the file has the field, false if not | boolean DocFile::insertStatusEntry | ( | String | action, |
| String | comment | ||
| ) |
Add an entry to the status tab of the file.
This function is especially useful in connection with PortalScripts being used as decision guards in workflows, because this allows to comment and describe the decisions taken by the scripts. This increases transparency concerning the life cycle of a file in DOCUMENTS.
| action | String containing a brief description |
| comment | optional String containing a descriptive comment to be added to the status entry |
true if successful, false in case of any error | boolean DocFile::isArchiveFile | ( | ) |
Gather information whether the current file is an archive file.
true if is an archive file, false if not | boolean DocFile::isDeletedFile | ( | ) |
Gather information whether the current file is a deleted file of a trash folder.
true if is a deleted file, false if not | boolean DocFile::isNewFile | ( | ) |
Gather information whether the current file is a new file.
true if new file, false if not | boolean DocFile::reactivate | ( | ) |
Reactivate an archive file to a file of the corresponding filetype.
true if successful, false if not - get error message with getLastError() | boolean DocFile::sendFileAdHoc | ( | Array | receivers, |
| String | sendMode, | ||
| String | task, | ||
| boolean | backWhenFinished | ||
| ) |
Send the DocFile directly.
| receivers | Array with the names of the users or groups to which to send the DocFile. You need to specify at least one recipient. |
| sendMode | String containing the send type. The following values are available:
|
| task | String specifying the task for the recipients of the DocFile |
| backWhenFinished | boolean indicating whether the DocFile should be returned to the own user account after the cycle. |
true if successful, false in case of any error. | boolean DocFile::sendMail | ( | String | from, |
| String | templateName, | ||
| String | to, | ||
| String | cc, | ||
| boolean | addDocs, | ||
| String | bcc | ||
| ) |
Send the file as email to somebody.
You must define an email template in the Windows Portal Client at the filetype of your DocFile object. This template may contain autotexts that can be parsed and replaced with their appropriate field values.
| from | String value containing the sender's email address |
| templateName | String value containing the technical name of the email template. This must be defined on the email templates tab of the filetype. |
| to | String value containing the email address of the recipient |
| cc | Optional String value for an additional recipient ("cc" means "carbon copy") |
| addDocs | optional boolean value whether to include the documents of the file |
| bcc | Optional String value for the email addresses of blind carbon-copy recipients (remaining invisible to other recipients). |
true if successful, false in case of any error bcc | boolean DocFile::setAttribute | ( | String | attribute, |
| String | value | ||
| ) |
Set the String value of an attribute of the file to the desired value.
| attribute | String containing the name of the desired attribute |
| value | String containing the desired value of the attribute |
true if successful, false in case of any error | boolean DocFile::setFieldAttribute | ( | String | fieldName, |
| String | attrName, | ||
| String | value | ||
| ) |
Set the value of an attribute of the desired file field.
| fieldName | String containing the technical name of the desired field |
| attrName | String containing the name of the desired attribute |
| value | String value containing the desired field attribute value |
true if successful, false in case of any error | boolean DocFile::setFieldValue | ( | String | fieldName, |
| var | value | ||
| ) |
Set the value of the desired file field.
| fieldName | String containing the technical field name can be followed by the desired instance number in form techFieldName[i] for multi-instance fields of an EE.i/EE.x archive file. Note: The index i is zero-based. The specification of field instance is only available for an EE.i/EE.x archive file, it will be ignored for other files. If the parameter contains no instance information, the first field instance is used. The field instance order is determined by the field order in the file. |
| value | The desired field value of the proper type according to the field type, e.g. a Date object as value of a field of type 'Timestamp'. Note: The keys of the enumeration values for a double select list field may be passed either as an Array of strings or as an ordinary string with one key per line of text (see Field Access Methods). |
true if successful, false in case of any error. | boolean DocFile::setFileOwner | ( | SystemUser | owner | ) |
Set the file owner of the file to the desired user.
| owner | SystemUser object representing the desired new file owner |
true if successful, false in case of any error | boolean DocFile::setFollowUpDate | ( | SystemUser | pUser, |
| Date | followUpDate, | ||
| String | comment | ||
| ) |
Set a followup date for a desired user.
| pUser | SystemUser object of the desired user |
| followUpDate | Date object representing the desired followup date |
| comment | optional String value containing a comment that is displayed as a task as soon as the followup is triggered |
true if successful, false in case of any error set the referred file of the desired reference field in the current file.
| fieldName | String value containing the technical name of the reference field |
| referenceFile | DocFile object representing the referred file |
true if successful, false in case of any error | boolean DocFile::setUserRead | ( | String | login, |
| boolean | fileRead | ||
| ) |
Mark the file as read or unread for the desired user.
| login | String containing the login name of the desired user |
| fileRead | boolean whether the file should be markes as read (true) or unread (false) |
true if successful, false in case of any error | boolean DocFile::setUserStatus | ( | String | login, |
| String | status | ||
| ) |
Set the status of the file for a desired user to a desired value.
The file icon in the list view and file view depends on this status.
| login | String containing the login name of the desired user |
| status | String value containing the desired status Allowed values:
|
true if successful, false in case of any error | boolean DocFile::startEdit | ( | ) |
Switch a DocFile to edit mode.
Switching a file to edit mode with this function has the same effect as the "Edit" button in the web surface of DOCUMENTS. This means, a scratch copy of the file is created, and any changes you apply to the file are temporarily stored in the scratch copy - until you commit() your changes back to the original file. There are a few scripting event hooks which disallow the use of this function at all costs:
onEdit hook - the system has already created the scratch copy. onCreate hook - a newly created file is always automatically in edit mode.You should avoid using this function in scripts that are executed inside a workflow (signal exits, decisions etc.).
true if successful, false in case of any error | boolean DocFile::startWorkflow | ( | String | workflowName | ) |
Start a workflow for the DocFile object.
| workflowName | String containing the technical name and optional the version number of the workflow. The format of the workflowName is technicalName[-version]. If you don't specify the version of the workflow, the workflow with the highest workflow version number will be used. If you want to start a specific version you have to use technicalName-version e.g. (Invoice-2) as workflowName. |
true if successful, false in case of any error | boolean DocFile::sync | ( | boolean | checkHistoryFields = false, |
| boolean | notifyHitlistChange = true, |
||
| boolean | updateRefFields = true, |
||
| boolean | updateModifiedDate = false |
||
| ) |
Synchronize any changes to the DocFile object back to the real file.
If you want to apply changes to file fields through a script that is executed as a signal exit inside a workflow, you should rather prefer sync() than the startEdit() / commit() instruction pair.
| checkHistoryFields | optional boolean parameter has to be set to true, if the file contains history fields, that are modified |
| notifyHitlistChange | optional boolean parameter indicates the web client to refresh the current hitlist |
| updateRefFields | optional boolean parameter indicates to update reference fields if using the property AutoUpdateByRefFields |
| updateModifiedDate | optional boolean parameter indicates to update the modification date of the file |
true if successful, false in case of any error | boolean DocFile::undeleteFile | ( | ) |
Relive a deleted file.
Sets the status active to a file and redraws it from the trash folder. Deleted files are not searchable by a FileResultSet. You can only retrieve deleted files by iterating throw the trash-folder of the users
true if successful, false if not | var DocFile::fieldName |
The technical name of a field.
Each field of a DocFile is mapped to an according property. You can access the field value with the technical name.