There is an application on Lotus notes 5. The getdocumentbykey function is not working if the view is open. If some other view is open or if the Database is closed then the function is working correctly and finding the document. How can we make it work even if the view is open? I have given the part of the code below. Thank you.
BillNo2 = cdoc.fieldgettext("Bill_No2")
Set view = db2.GetView("Bill No.")
Set doc = view.getdocumentbykey(BillNo2)
If Not doc Is Nothing Then
doc.DOdone = "Done"
doc.LorryNo = cdoc.fieldgettext("Lorry_No")
doc.TripNo = cdoc.fieldgettext("Trip_No")
Call doc.save(True, True)
End If
While debugging, its skipping the line “If Not doc is Nothing” and ends the loop even there is document. The same code works fine if the view is not open. Kindly help me. Thanks.
This sounds like a bug, which is entirely possible given that we’re talking about a version that came out 13 years ago. But a few things to check first:
If neither of those are true, or you can’t change that view for business reasons, I think Anders’s suggested workaround of using a hidden view is an excellent idea and should solve the problem.