Florin M.
Florin M.

Reputation: 2169

xpages getDocument().getUniversalID()

I just want to test something about getting the UniversalID:

I create a computed field:

 <xp:text escape="true" id="computedField3"
    value="#{javascript:Cdoc.getDocument().getUniversalID()}">
</xp:text>

When I compose the doc. content which is on a Xpage, the computed field is already having some UNID and it is changing if I hit refresh. In lotus notes programming, the UNID could be get only if the current document was saved, having the default value @Text(@DocumentUniqueId).

Should I save first the Cdoc datasource to get the correct UNID? I know I'm missing something.

Thanks for your time

Upvotes: 3

Views: 2247

Answers (1)

Knut Herrmann
Knut Herrmann

Reputation: 30970

If you refresh your page in browser then actually a new document gets created. That's why you get a different UNID.

From your previous questions I know that you define your Cdoc as a data source with

<xp:this.data>
    <xp:dominoDocument
        var="Cdoc"
        formName="fmPersContact">
    </xp:dominoDocument>
</xp:this.data>

and that means that this Cdoc is created every time you open this XPage.

Update:

In addition, you get also a different UNID every time your field gets calculated on server when you do a partial refresh and document is not saved yet.

Upvotes: 4

Related Questions