cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve A Document's "Created By" Property Using VBScript (OnBase 15)

Chris_Johnson1
Champ in-the-making
Champ in-the-making

I have a VBScript which runs as a Custom Processing operation on documents in my scan queue. I am able to retrieve the BatchID and save it to a keyword but am having trouble getting the "Created By" property.

Here is the code:


' ######### Begin Variables #############

'--OnBase Variables
Dim obapp    ' OnBase Application
Dim curdoc      ' Current Document Object
Dim batchid    ' Current Batch ID
Dim scanuser    ' Name of the scan user

' ######## Begin Script #################
 
Sub Main35()


 set obapp = CreateObject("onbase.application")

 set curdoc = obapp.CurrentDocument


 batchid = curdoc.Batch

 call curdoc.Keywords.AddKeyword("Batch Number", batchid)


' ########### Stuck Here ###########
 scanuser = ?????

' ########### Stuck Here ###########


call curdoc.Keywords.AddKeyword("User", scanuser)

 curdoc.StoreKeywords


 set curdoc = Nothing

 set obapp = Nothing

End Sub

 

Can anyone help with how to get the scanuser value?

1 ACCEPTED ANSWER

Steve_Reed
Employee
Employee

Hi Chris,

The CurrentDocument object of the automation API does not currently expose the user that created the document, so the only recourse I can think of in your script would be to use ADO to select it out of the database using the batch ID (because it sounds like you want the user that created the batch - not necessarily the user that is currently listed as the 'owner' of the document - that would be updated to the last person that indexed the document).  So - if you want the creator, then use ADO to execute this:

"select u.username from hsi.useraccount u inner join hsi.archivedqueue a on u.usernum = a.usernum where a.batchnum = " & batchid

View answer in original post

2 REPLIES 2

Steve_Reed
Employee
Employee

Hi Chris,

The CurrentDocument object of the automation API does not currently expose the user that created the document, so the only recourse I can think of in your script would be to use ADO to select it out of the database using the batch ID (because it sounds like you want the user that created the batch - not necessarily the user that is currently listed as the 'owner' of the document - that would be updated to the last person that indexed the document).  So - if you want the creator, then use ADO to execute this:

"select u.username from hsi.useraccount u inner join hsi.archivedqueue a on u.usernum = a.usernum where a.batchnum = " & batchid

That's kinda what I figured. Thanks Steve.