Samuel Omopariola
Samuel Omopariola

Reputation: 153

Xpages - How to access the newly generated UniversalID and send it on submit in Xpages

I want to be able to send the UNID of the newly created document to the user, so that the user can access the document. In the execution script;

var unid = param.documentId;
var vUnid = newDocId.getDocument().getUniversalID;

Both were picking up the parent UNID, which already existed in the browser.

enter image description here

This image will show you how the document looks like and will be grateful to know how to pass the newly generated UNID when document is submitted.

Upvotes: 1

Views: 189

Answers (2)

Knut Herrmann
Knut Herrmann

Reputation: 30960

Write your newly generated UniversalID into a sessionScope variable

sessionScope.newUnid = newDocId.getDocument().getUniversalID;

and use it in next XPage called after submit

var useTheNewUnid = sessionScope.newUnid;

Upvotes: 1

stwissel
stwissel

Reputation: 20384

You need to add your code into the postSave event of your data source. The UNID for a new document only gets set when saved for the first time. Before that it's a temp value only

Upvotes: 2

Related Questions