Xpages: Doc locking error

前提是你 提交于 2019-12-12 03:28:20

问题


Trying to implement document locking in a small database. We use it in XPiNC. I found Julian Boss's excellent answer in in which he provides a javascript function that seems to have everything I need.

So in a small test database I added the script library and added as a resource. In my edit button I have the following code:

var ntdDoc:NotesDocument = document1.getDocument();
documentLocking.lockDoc(ntdDoc)

But this throws the following error:

Script interpreter error, line=2, col=17: [TypeError] Error calling method 'lockDoc(lotus.domino.local.Document)' on an object of type 'Object [JavaScript Object]'
     1: var ntdDoc:NotesDocument = document1.getDocument();
->   2: documentLocking.lockDoc(ntdDoc)

I have tried passing in the data source and that didn't work either. What do I need to pass?


回答1:


That answer is a few years old and I'm not sure of the current recommendations around storing SSJS global variables. Storing SSJS functions as objects is no longer recommended.

Domino has in-built document locking, which is equally valid for use in XPages. Mastering XPages Second Edition had a very good and comprehensive walk-through of how to use the document locking. The only (potential) gotcha is that you need to lock the document before deleting it - because to delete it you need to modify it, and to modify it you need to lock it.



来源:https://stackoverflow.com/questions/33268746/xpages-doc-locking-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!