docflow

Top  Previous  Next

The docflow object is used extensively by the DocFlow component, and some of its methods are useful in custom programming as well.  In particular, the createdoc() method is used to start an existing library document in a flow, and run the flow's initialize routine.

 

Many of its methods are duplicated in the docflowdoc object, for convenience when scripting with a particular document in a flow.

 

Properties

lasterrmsg$ contains the last error message from an operation.

 

 

Methods

addnote(flowid$,doctype$,docid$,note$) adds a note to the specified document.

addstamp(flowid$,doctype$,docid$,stampname$,left,top) adds the named stamp file to the flow document.  The stamp name should be the base filename of a stamp image in the df/stamps directory.  Left and top specify the position on the page in inches.

advance(flowid$,doctype$,docid$,errmsg$) moves the specified document a step forward in the flow, and runs the advance script code.  The errmsg$ variable returns any errmsg$ set in the script code.  This operation is normally performed through the user interface.

attachfile(flowid$,doctype$,docid$,file$[,newsubid$[,title$]]) adds the specified file, found on the unform server, as an attachment to the document specified.  If newsubid$ is supplied, it is filled with the subid of the file just added.  The subid is generated as 'upload*' in order to ensure that the file is copied to the original source document when the document is finalized.  The title$ value, if supplied, creates a title for the attachment in the browser interface.  If not supplied, the file name is used.

attachsubdoc(flowid$,doctype$,docid$,fromlib$,fromdoctype$,fromdocid$,fromsubid$[,newsubid$]) attaches an existing library archive image to the specified document in a flow.  Flowid$, doctype$, and docid$ identify which flow document to modify, and fromlibrary$, fromdoctype$, fromdocid$, and fromsubid$ identify which existing image to attach.  If newsubid$ is supplied, it is filled with the subid of the attachment just added.

createdoc(flowid$,fromlib$,fromdoctype$,fromdocid$,fromsubid$,docprop$[,additionals]) adds a new image to the specified flow library.  The source image is specified in the fromlibrary$, fromdoctype$, fromdocid$, and fromsubid$ values.  It fills docprop$ with a document property template of the newly created document in the flow's system library.  If additionals is provided, it is used to automatically add attachments to the document.  If set to 1 all non-@text subids of the source document are attached.  If set to 2, all images linked from the source document are attached.  If set to 3, both non-@text subids and linked images are added as attachments.

createdoc(flowid$,fromlib$,fromdoctype$,fromdocid$,fromsubid$,docprop$[,links$]) adds a new image to the specified flow library.  The source image is specified in the fromlibrary$, fromdoctype$, fromdocid$, and fromsubid$ values.  It fills docprop$ with a document property template of the newly created document in the flow's system library.  If links$ is provided, it should be line-feed delimited library image identifiers, which is a pipe- or tab-delimited value of library, doctype, docid, and subid values to extract images from.  These are all added as attachments.

delstamp(flowid$,doctype$,docid$,stampname$) removes stamps of the specified name from the flow document.  The stamp name is the base filename of the stamp image from the df/stamps directory.  Note the extension of the file is not needed, for example either "approved.jpg" or "approved" work.

finish(flowid$,doctype$,docid$,errmsg$) completes the document flow, creates the XML document and any attachment or annotation images, and runs the finalize script code.  If the script code sets errmsg$, it is returned, though the finalize actions are not stopped.  This operation is normally performed by the user interface, but script code could do so if there is reason to finalize a document without user action.

flowrange$(id$,first,count) returns a tab-separated-values list of documents in the specified flow.  Each row includes doctype, docid, and timestamp columns.

flowstep$(flowid$,step) returns the flow step name of the 1-based step number.

flowsteprole$(flowid$,stepname$|stepnum) returns the role name assigned to the step name or number in the specified flow definition.

flowsteps(flowid$) returns the number of steps defined in the flow specified.

flowsteps$(flowid$) returns a list of linefeed-delimited steps for the specified flow definition.  Each step is a tab-delimited row of name, description, and role name.

getdocdata(flowid$,doctype$,docid$,data$) creates the data$ template with the following fields: library$, doctype$,docid$,subid$,started$, updated$, step$, updatehist$, notes$, duedate$, invaliditems$, annotations$, stephist$.  These equate to properties in the docflowdoc object, and are further documented there.  This information should be considered read-only.

getdocsbysource$(library$,doctype$,docid$[,flowid$]) returns a linefeed-delimited list of flow records found in active flows for the source document specified by library$, doctype$, and docid$.  The source document is the original document that contains the subid any given flow record was started from.  All subids for the specified document are checked.  If the flowid$ argument is supplied, only records from that flow are returned.  The records are in tab-delimited format, with the flowid, doctype, and docid of the flow library record, suitable for creation of a docflowdoc object for further information. If the flowid$ argument is supplied, the returned list has just doctype and docid values.

getfield$(flowid$,doctype$,docid$,name$) returns the value of the custom field identified by name$ from the flow document specified.

getfield(flowid$,doctype$,docid$,name$,value$) fills value$ with the value of the custom field identified by name$ from the flow document specified.

getrole(roleid$,roleprop$) fills the rollprop$ template with role properties, which are: roleid$, description$, and members$, a semi-colon delimited list of user ID's who are members of the role.

getparam$(flowid$,name$) returns the value of the named parameter in the specified flow definition.  It returns null if the flow id doesn't exist or the parameter name doesn't exist.

hasstamp(flowid$,doctype$,docid$,stampname$) returns true (1) if the named stamp exists on the flow document, or false (0) if not.  Note the extension of the file is not needed, for example either "approved.jpg" or "approved" work.

libname$(id$) returns the library pathname of the source id$, used when access to a library object for the library is required.

putfield(flowid$,doctype$,docid$,name$,value$) sets the value of the named field for the specified document.

delfield(flowid$,doctype$,docid$,name$) removes the specified field in the specified document.  This doesn't remove it from the flow definition, but just removes the record where it was stored for the document.  It has the same effect as putfield with value$="".

getfields$(flowid$) returns a line-feed delimited list of custom field names for the flow definition specified.

nextstep$(flowid$,curstep$) returns the next sequential step name after the specified step name, in the flow specified.  If the current step is the last step, "*" is returned.  Use this function to retrieve the default next step in script code, in cases where the step order is not modified by scripting.

paramexists(flowid,name$) returns true (1) if the named parameter exists in the specified flow definition, false (0) otherwise.

reverse(flowid$,doctype$,docid$,errmsg$) moves the specified document a step backward in the flow.  The errmsg$ variable is filled if an unexpected error occurs. This operation is normally performed through the user interface.

setstep(flowid$,doctype$,docid$,step|stepname$) sets the current step number of name of the specified document.

signaturefile$(flowid$,doctype$,docid$) extracts the signature file associated with the flow document and stores it as a JPEG file on disk, and returns the file name.  If no signature file exists, null ("") is returned.

signatureid$(flowid$,doctype$,docid$) returns the subid of a signature image found in the flow document's attachments.  It returns null ("") if no signature file exists.  The signature file is identified as an attachment with an "upload" prefix and a title of "df-signature.jpg".

transfer$(fromflowid$,fromdoctype$,fromdocid$,toflowid$) transfers a flow document to a different flow. It returns the new flow document in a colon-delimited structure flowid:doctype:docid.  The from document identification can be found in a docflowdoc object, typically the "doc" variable in flow scripting, as doc'flowid$, doc'dfdoctype$, and doc'dfdocid$.

updatehist(flowid$,doctype$,docid$,what$) adds a message what$ to the update history of the specified document.