|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Event Scripts > Workflow > OnChangeWorkflowState.LST script file |
Manages the event of changing the current Workflow State in a process for a particular document
Options→Environment→Workflow
@DOCUMENT_UNIQUE_ID |
the document unique id |
|---|---|
@ECO_ID |
the ECO_ID |
@PROCESS |
the Workflow Process name assigned to the document |
@FROM_STATE |
the state from which the process comes from |
@TO_STATE |
the state to which the process goes to |
@FROM_STATE_INDEX |
the index ( 0..N ) of the state from which the process comes from |
@TO_STATE_INDEX |
the index ( 0..N ) of the state to which the process goes to |
@SILENT |
0/1 ( 1 if no input should be required ) |
@IS_LAST_DOC |
0/1 ( 1 if TRUE ) |
@EVENT_LOG_NOTES |
optional notes that will be inserted in the event log table |
|---|---|
@EVENT_LOG_FILE_ATTACHMENTS |
optional file attachment that will be inserted in the event log table; this file attachment will be available to the workflow user interface for opening and for tracking all the red-linings along the workflow process |
.VBSCRIPT
const eDrawingsRoot = "W:\eDrawings\"
sub main
DBWInit(TRUE)
silent = DBWInput("@SILENT")
ecoId = DBWInput("@ECO_ID")
process = DBWInput("@PROCESS")
fromState = DBWInput("@FROM_STATE")
toState = DBWInput("@TO_STATE")
docUid = DBWInput("@DOCUMENT_UNIQUE_ID")
if silent = 0 then
DBWMsgBox "Change State in process " & process & vbcrlf &_
"From=" & fromState & vbcrlf &_
"To:" & toState & vbcrlf &_
"Document Unique Id=" & docUid
myNotes = InputBox("Insert a note for this event:")
if myNotes<>"" then
DBWOutput "@EVENT_LOG_NOTES",myNotes,ForWriting
end if
'
' check for the availability of an eDrawing
'
Set fs = CreateObject("Scripting.FileSystemObject")
eDrawingID = ecoId + "_" + docUid
eDrawingPath = ""
tempPath = eDrawingsRoot + eDrawingID + ".EASM"
If (fs.FileExists(tempPath)) Then
eDrawingPath = tempPath
else
tempPath = eDrawingsRoot + eDrawingID + ".EPRT"
If (fs.FileExists(tempPath)) Then
eDrawingPath = tempPath
else
tempPath = eDrawingsRoot + eDrawingID + ".EDRW"
If (fs.FileExists(tempPath)) Then
eDrawingPath = tempPath
end if
end if
end if
set fs = nothing
if eDrawingPath<>"" then
DBWOutput "@EVENT_LOG_FILE_ATTACHMENT",eDrawingPath,ForAppending
end if
end if
end sub