【问题标题】:ParameterDocID gets only 6 digit of my DocumentUniqueID参数 DocID 仅获取我的文档唯一 ID 的 6 位数字
【发布时间】:2019-04-04 13:45:53
【问题描述】:

我正在从我的 Javascript 应用程序调用特定的 IBM Notes 代理。从 Javascript 到 Notes 代理的调用使用参数进行。此参数是通用 ID。

不幸的是,我的代理只获得了我的通用 ID (DocumentUniqueID) 的 6 位数字。但我想拥有我的 UniversalID 的全长。缺少什么,有什么想法吗?

我的 Javascript:

//more code before....

var UID = new String
UID$ = doc.getUniversalID()

// notes agent
var notesAgent = db.getAgent("NameOfMyNotesAgent");

// execute notes agent
var agentResult = notesAgent.runOnServer(UID$)

如果我输出我的 UID,它是通用 ID 的全长。这不是问题。

我的 Notes 代理 (NameOfMyNotesAgent):

Dim agent As NotesAgent
Dim sess As New NotesSession    
Dim db As NotesDatabase

Set db = sess.CurrentDatabase   
Set agent = sess.CurrentAgent

Dim docUID As String    
docUID = agent.ParameterDocID

'Display Notes document UID
Print "******************************"
Print "Notes Document UID: " & docUID
Print "******************************"
' I only get the last 6 part of the DocumentUniqueID, not the full one. Why?

编辑:

我从 Knut Herrmann 那里得到信息,这与只接受 noteIDrunOnServer 有关。

由于不同副本中的 NoteId 更改,我想使用 DocumentUniqueID 执行此操作。我可以使用哪种方式,有其他方法吗?

【问题讨论】:

    标签: javascript lotus-notes lotus-domino lotusscript lotus


    【解决方案1】:

    代理的runOnServer(String noteID) 只接受noteId 作为参数,而不接受UniversalId。

    所以,把你的代码改成

    var noteID = doc.getNoteID()
    ...
    var agentResult = notesAgent.runOnServer(noteID)
    

    【讨论】:

    • 啊,现在我明白了。那很糟。我在上一个问题中得到了 Torsten Link 的建议,不要使用 noteID。原因是,如果有 db 的副本,则可以更改此值。这就是为什么我更喜欢 DocumentUniqueID 的方式。我如何使用 DocumentUniqueID 实现这一点 - 任何可能的解决方案?
    • Torsten 的建议不适用于这种情况。您已经有一个 doc 对象。现在,您使用 noteID 指向此文档并立即调用 runOnServer。这是安全的。
    • 不要误会我的意思:正确的工具解决正确的问题...您从当前文档中获取 NoteID 并且 runOnServer 想要一个 NoteID...所以使用 NoteID 没有任何问题。在硬编码或在多个服务器上使用 noteid 时,使用 noteid 只是一个坏主意......对于这个例子来说,它是完美的
    • 哦……现在我明白了。非常感谢你们俩,对这种情况感到抱歉。
    • 另外,切勿存储 NoteID 以供日后使用。到你使用它的时候,它可能已经改变了。
    猜你喜欢
    • 1970-01-01
    • 2012-08-24
    • 1970-01-01
    • 2020-04-14
    • 1970-01-01
    • 1970-01-01
    • 2011-10-07
    • 2012-04-05
    • 1970-01-01
    相关资源
    最近更新 更多