lotus notes - LotusScript: Saving on read mode on Audit Trail -
i have audit trail records 2 fields. want ask if possible save changes in audit trail while on read mode? code doesn't record while on read mode. can me guys? here's code:
querysave:
sub querysave(source notesuidocument, continue variant) initial = source.isnewdoc if initial m$ = session.commonusername & " - " & cstr(now()) & " - document created" forall f in old v$ = source.fieldgettext(listtag(f)) if not initial , not v$ = f if m$ = "" m$ = session.commonusername & " - " & cstr(now()) & " - modified " else m$ = m$ & ", " end if if f = "" f = {""} m$ = m$ & listtag(f) & " " & f & " " & v$ end if f = v$ end forall if initial source.fieldsettext "history", m$ elseif not m$ = "" source.fieldappendtext "history", chr$(10) & m$ end if x: exit sub e: continue = false resume x end sub
postopen:
sub postopen(source notesuidocument) set session = new notessession old("docname") = source.fieldgettext("docname") old("docstatus") = source.fieldgettext("docstatus") 'disable edit in double click set uidoc = source set doc = uidoc.document doc.mc = 1 end end sub
whenever need use variables/objects between events , not want pollute document temporary values, use global variables everything.
on postopen document presumably in read mode, changes make fields on backend document (ie uidoc.document) during event while document in read mode not "stick" because you're writing object in read-mode. "old" list variable global (?), instead of trying write "history" field, setup "history" variable global string variable, don't try , write document during postopen. when querysave event triggers write global "history" string variable onto history field on document.
Comments
Post a Comment