我有两个原始文件和复印文件。保存副本时,原件也会更改状态。
接着回答我的另一个问题Save copy document and change status field for copy document and original document using lotusscript button。下面是我的代码。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim activeDoc As NotesDocument
Dim view As NotesView
Dim keys(1) As String
'// Set database and doc
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
keys(0) = doc.PTagNo(0)
keys(1) = "Lock"
Set view = db.GetView("Computer")
vpswd = Inputbox$("Pls input code to save :")
If vpswd = "o" Then
Set activeDoc= view.GetDocumentByKey(keys, True)
If Not activeDoc Is Nothing Then
If activeDoc.PStatus(0) = "Lock" Then
activeDoc.DocumetId = doc.UniversalID
Call activeDoc.ReplaceItemValue("PStatus", "Inactive")
Call activeDoc.Save(True, False)
End If
End If
Call uidoc.FieldSetText("PStatus" , "Active")
Call uidoc.FieldSetText("SaveOptions" , "1")
Call uidoc.Save
Call uidoc.Close
Else
Msgbox "Wrong Code"
Exit Sub
End If
End Sub
我已经设置了变量并成功保存了。保存后,将保存“复制文档”并将其状态更改为“活动”,但对于当前处于“锁定”状态的“当前”文档,则不会更改为“非活动”状态。谁能帮我?我在编码中犯了任何错误?您的帮助非常感谢。谢谢!
答案 0 :(得分:0)
我已经解决了这个问题。对于我的问题,我没有将TagNo设置为第一列。所以我需要用两列创建新视图,即TagNo和Status。将两列都设置为升序。