Field Modification Audit

schmad01
schmad01 used Ask the Experts™
on
I am upating a document's field(field1) from a button on a different form through the use of an agent.

I want to have a second field(field2) below field1 showing who modified field1.  How can I accomplish this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
And the time it was modified as well.
Bozzie4IT Architect

Commented:
Write the time and the user's name to that field with the agent you update the first field.
So add logic to do:
...
doc.Field2 = s.effectiveusername ' where s is the current notessession (from the agent)
doc.Field3 = now ' where field3 is the name of the field you want the date in.
...


cheers,

Tom
Bozzie4IT Architect

Commented:
You should btw save the document then...
...
 call doc.save( true, false )

cheers,

Tom
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

I beleive you are going to hit a collection of documents.... a continuation from the previous question...

just have

doc.LastEdited = ss.CommonUserName
doc.LastModified = now()

-Arun.
dim session as new notessession
dim db as notesdatabase
set db = session.currentdatabase
dim ws as new notesuiworkspace
dim uidoc as notesuidocument
set uidoc = ws.currentdocument
set doc = uidoc.document
set view = db.getview("<viewname>")
set doccoll = view.getalldocumentsbykey(doc.fieldname(0))
if doccoll.count > 0 then
set currentdoc = doccoll.getfirstdocument
while not currentdoc is nothing



currentdoc.LastEdited = ss.CommonUserName
currentdoc.LastModified = now()





currentdoc.updatefieldname= "value"
currentdoc.save true,true
set currentdoc = doccoll.getnextdocument(currentdoc)

wend
else
Msgbox "Match not found "

end if

Author

Commented:
Arun,
I added those to lines and get the error - Variant does not contain an object.

Here is the code as it stands now:

Dim session As New notessession
      Dim db As notesdatabase
      Set db = session.currentdatabase
      Dim ws As New notesuiworkspace
      Dim uidoc As notesuidocument
      Set uidoc = ws.currentdocument
      Set doc = uidoc.document
      Set view = db.getview("Batch_Update_View")
      Set doccoll = view.getalldocumentsbykey(doc.b_number(0))
      If doccoll.count > 0 Then
            Set currentdoc = doccoll.getfirstdocument
            While Not currentdoc Is Nothing
                  currentdoc.stat_modby = ss.CommonUserName
                  currentdoc.stat_modtime = Now()
                  currentdoc.b_status= doc.b_action(0)
                  currentdoc.save True,True
                  Set currentdoc = doccoll.getnextdocument(currentdoc)
                  
            Wend
      Else
            Msgbox "Lot number not found !"
            
      End If
      

Author

Commented:
Anyone?

Author

Commented:
Points added.  Any takers?
I can help you fix it.  Can you put the client in debug mode and tell me exactly where your code bombs out ???

I am so stupid.

Change the

ss.CommonUserName
to
session.CommonuserName

Sorry about my code though.


Thanks for the pts.

Author

Commented:
Ok I am going to post another question to add on to this project.  Some managers are just never satisfied!
like we are never satisfied with pts...  *Smile*

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial