OnSendWorkflowNotificationToUsers.LST script file

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Event Scripts > Workflow >

OnSendWorkflowNotificationToUsers.LST script file

Description

It manages the event of sending a notification to the user(s) who submitted a document to the Workflow Module.

Activation

Options→Environment→Workflow

Input

@USER_NAME

the name of the user who submitted the approval request

@WORKFLOW_PROCESS_RESULT

0: rejected
1: approved

@DOCUMENT_UNIQUE_IDS

comma separated list of the unique ids of the documents submitted

@ECO_ID

the current ECO_ID being approved

Example

Simple notification

.VBSCRIPT

sub main
 DBWInit(TRUE)
 userName = DBWInput("@USER_NAME")
 workflowProcessResult = DBWInput("@WORKFLOW_PROCESS_RESULT")
 documentUniqueIds = DBWInput("@DOCUMENT_UNIQUE_IDS")
 DBWMsgBox "OnSendNotificationToUsers" & vbcrlf &_
  "User Name:" & userName & vbcrlf &_
  "Workflow Process Result:" & workflowProcessResult & vbcrlf &_
  "Document Unique Ids:" & documentUniqueIds
end sub

Automatic approval of documents after the OK from the workflow

.VBSCRIPT

sub main
        DBWInit(TRUE)
        userName = DBWInput("@USER_NAME")
        workflowProcessResult = DBWInput("@WORKFLOW_PROCESS_RESULT")
        documentUniqueIds = DBWInput("@DOCUMENT_UNIQUE_IDS")
        if workflowProcessResult = 0 then exit sub
        tokens = Split(documentUniqueIds," " )
        for i = 0 to Ubound(tokens)
                myT = DBWQueryByUID(tokens(i), "T")
                myState = DBWQueryByUID(tokens(i), "STATE")
                if (myT = "P" or myT = "A") and myState = "CHECKED_IN" then
                        DBWShell "IncrementRevisionState " & tokens(i)
                end if
        next
end sub