【问题标题】:LotusScript Function Doesn't Save Form FieldsLotusScript 函数不保存表单字段
【发布时间】:2012-09-12 20:49:12
【问题描述】:

谁能找到一个明显的原因来解释为什么我的保存功能没有保存表单中的字段?它保存了文档,但是当我打开它时字段是空的。以下代码是我正在使用的:

 Public Sub co_loopNamesAndSaveDocs()

'Dim variables  
 Dim s As New NotesSession
 Dim thisDatabase As NotesDatabase
 Set thisDatabase = s.CurrentDatabase
 Dim ws As New NotesUIWorkspace
 Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim currentDoc As NotesDocument 
Set currentDoc = uidoc.Document
Dim newDoc As NotesDocument
Dim PersonNameField As NotesItem
Set PersonNameField = currentDoc.GetFirstItem("PersonName")

'Loop through values in PersonNameField and create a new document for each value found

Forall pName In PersonNameField.Values

Set newDoc = New NotesDocument (thisDatabase)
newDoc.Form="newLocationForm"
newDoc.StartDate = currentDoc.StartDate(0)
newDoc.EndDate = currentDoc.EndDate(0)
newDoc.Duration = currentDoc.Duration(0)
newDoc.StartTime = currentDoc.StartTime(0)
newDoc.EndTime = currentDoc.EndTime(0)
newDoc.Comments = currentDoc.Comments(0)
newDoc.Status = currentDoc.Status(0)
newDoc.LocationCode = currentDoc.LocationCode(0)
newDoc.PersonName = pName
Call newDoc.Save (True, False, False)

End Forall

End Sub

提前致谢。

【问题讨论】:

    标签: function lotus-notes designer lotusscript


    【解决方案1】:

    由于我在编码中没有看到明显的错误,我会说 newDoc 中的字段是空白的,因为 currentDoc 中的字段是空白的。由于 currentDoc 设置为 uidoc.Document,这可能意味着您在前端和后端文档之间存在同步问题。即,这些值存在于您的 uidoc 中,但在调用此代码之前尚未保存到后端。如果我是对的,请在分配 currentDoc 之前尝试调用 uidoc.save()。如果您不想保存到后端,那么您应该使用 uidoc.fieldGetText("PersonName") 并解析出值,而不是使用后端作为数据源。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-31
      • 1970-01-01
      • 1970-01-01
      • 2021-09-18
      • 1970-01-01
      相关资源
      最近更新 更多