Hello
I am writing a generic function in LS called getDocument( key as String )
where key could be a universal id, note id or some other key.
The function searches first by note id, then by universal id and finally for some other key. see code below ( I omit error handling for brevity )
set doc = db.getDocumentById( key )
if doc is nothing then
set doc = db.getDocumentByUNID( key )
if doc is nothing then
…
let say I have a document like this
UNID = ACL16018A08E583C9F9EA862572BF005CEEAE4
NOTE ID = 00020ED2
these are a real universal id and note id of a document.
If I run the code using the unid above I expect getDocumentId to fail and then the program
to try the getDocumebtByUNID. But what getDocumentById actually does is to use the last 8 digits of the unid as a note id and does the search using 005CEEAE4 ( which is obiously the wrong note id). if this value happens to be a real note id of another document then the function returns the wrong document.
obviously the solution is to switch conditions but my point is that this behaviour is a bug since is not specified in the help section for getDocumentbyID()
This is actually happening in an application and messing some data!