Skip to main content link. Accesskey S
  • Help
  • IBM Logo
  • IBM Notes and Domino Application Development wiki
  • All Wikis
  • All Forums
  • THIS WIKI IS READ-ONLY. Learn more...
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
  • API Documentation
Search
Community Articles > Programming > Agents > How do I get the NoteID or UNID of the document I just created via an XPage?
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Click to view profileThomas Gumz
Contribution Summary:
  • Articles authored: 18
  • Articles edited: 21
  • Comments Posted: 1

Recent articles by this author

How can I open documents in a traditional Form rather than an XPage from a viewpanel?

Question:

I have an XPage viewpanel which shows documents from a view. A column is configured to show values as links. However, the links by default open the document in another XPage. How can I change the default link generated for each entry in the view panel to open the document ...

How does "At runtime, open selected document using" work in XPages view panels?

Question:

How does the "At runtime, open selected document using" option work in XPages views?

Answer:

This option may be ambiguous on first reading, but it's probably best explained using the following use case: You have a view panel which uses a Notes View as a data source ...

Are global variables in server-side JavaScript libraries shared across sessions in XPages?

Question:

Are global variables in server-side JavaScript libraries shared across the board regardless of the user/session ?

Answer:

Yes, global variables defined in server-side JavaScript libraries are initially indeed globally shared across sessions. However, they are not ...

How can I use native html tags inside XPages?

Question:

How can I use native html tags inside XPages?

Answer:

There are 3 different ways to manually use html tags in XPages:

#1: You can use the Computed Field control to emit the required HTML in its value property.

Make sure to set the Content type to HTML (so ...

How can I use pattern matching to validate input on fields in XPages?

Question:

Is there an easy way to do pattern matching validation on fields such as an edit box?

Answer:

To enable pattern matching on an edit box: Go to the All Properties tab Click into the validators property Click the add button that appears and choose ...
Community articleHow do I get the NoteID or UNID of the document I just created via an XPage?
Added by Thomas Gumz | Edited by IBM contributorDeanna Drschiwiski on October 30, 2009 | Version 7
  • Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: 8.5, FAQ, JavaScript, XPages, UNID, NoteID

Question:


Is there a way to get the NoteID or UNID of the document I just created via an XPage?
For example, I want to fill out a form within an XPage and have it create a document (associated with a form) when I hit submit.
I want to know the NoteID or UNID of the note that was just created so I can have an agent run against it after the data source gets saved (after the submit)

Answer:


The easiest way to do this is to use the data source events. In this case, you could use the querySaveDocument or postSaveDocument event:
(In this example, the data source is named "filedoc" )



Since the XPage is bound to a Domino document data source, you can use the data source name in JavaScript inside these events to refer to it and get the NoteID or UNID (or call any of the Domino back-end classes)

The datatype of the document data source inside those events is a NotesXspDocument object. You can use .getDocument() to get to the back-end NotesDocument object:

 var doc:NotesDocument = DataSourceName.getDocument();
var sUNID = doc.getUniversalID();
var sNoteID = doc.getNoteID();

A couple of things to keep in mind:
  • Newly created documents do not have a NoteID unless they've been saved to disk.
    So, in the querySaveDocument() event, the NoteID is not available, but it is in the postSaveDocument() event.

  • The UNID is available in the QuerySaveDocument() event though.


  • Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (7)
collapsed Versions (7)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (7)Oct 30, 2009, 12:57:46 PMDeanna Drschiwiski  IBM contributor
6Oct 21, 2008, 7:31:19 PMThomas Gumz  IBM contributor
5Oct 21, 2008, 7:30:40 PMThomas Gumz  IBM contributor
4Oct 21, 2008, 7:28:16 PMThomas Gumz  IBM contributor
3Oct 21, 2008, 7:27:54 PMThomas Gumz  IBM contributor
2Oct 21, 2008, 7:26:47 PMThomas Gumz  IBM contributor
1Oct 21, 2008, 7:21:19 PMThomas Gumz  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkThe Social Lounge
  • Wiki Help
  • Forgot user name/password
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use