DBWCheckoutAsDifferentUser

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > Revision >

DBWCheckoutAsDifferentUser

Description

Checks-out a document whose unique is id equal to docUid, impersonating the user with name equal to UserName.

Syntax

Sub DBWCheckoutAsDifferentUser(docUid, UserName)

Parameters

docUid

It is the unique id of the document to checkout.

UserName

It is the name of the user to make the checkout action by.

Remarks

This subroutine is useful to automate processes of checking-out documents from an administrator workstation, assigning the jobs to the designers of the team.

Syntax

Sub main()
 UserList = "Ciro" & vbCRLF &  "Gaetano" & vbCRLF & "Giorgio"
 DBWInit(true)
 call DBWShell( "CurrentDocument" )
 if (okDBW = False) then
  MsgBox "Must select a Document"
  exit sub
 end if
 docUId = DBWResult( "@DOCUMENT_UNIQUE_ID" )
 docstate = DBWGetDocState( docUId , revision)
 if docstate=DBWLookup("NAME_STATE_CHECKED_IN_STRING") then
  title = "Choose User for CheckOut"
  ok = DBWList( UserList , title, "0",UserCheckout )
  if ok then
   DBWCheckoutAsDifferentUser docUId, UserCheckout
  else
   exit sub
  end if
 else
  MsgBox "Document must be in checkin state"
  exit sub
 end if
End Sub