OnDeleteAttachment.LST script file

<< Click to Display Table of Contents >>

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

OnDeleteAttachment.LST script file

Description

This script is fired when deleting an attachment through the RMB Remove this attachment functionality of the Attachment grid:

OnDeleteAttachment

Activation

Options→General

Input

@DOCUMENT_UNIQUE_ID

uid of the DOCUMENT record the attachment is linked to

@DOCUMENT_PATH_NAME

the attachment full file path

Output

@OKDELETE

Validate the attachment deletion
0:stop deletion
1:proceed with deletion

Example

Allow attachment deletion for checkedout documents only:

'x64

.VBSCRIPT
Sub Main()
 DBWInit(True)
 uid = DBWInput("@DOCUMENT_UNIQUE_ID")
 state = DBWQueryByUid(uid,DBWLookup("NAME_FIELD_STATE"))
 okDel = 0
 If UCase(state) = UCase(DBWLookup("NAME_STATE_BEING_MODIFIED_STRING")) then
  okDel = 1
 End If
 DBWOutput "@OKDELETE",okDel,ForWriting
End Sub