1
votes

i have a computed when composed field in lotus notes (with formula @unique). I'm trying to retrieve this value and assigning it to a viewScope (in "after page load" event of the page in the following way

viewScope.unid=currentDocument.getItemValueString("unid"). 

My problem is when i open the page for first time it is working correctly (assigns the value to viewScope). But when i refresh the page viewScope is blank. i have also tried retrieving the computed when composed value to an xpage with no luck. am i doing anything wrong here?

there is one catch here, i'm opening the document from lotus notes view (not from any container controls //?opendocument) and this documents opens using xpage

1

1 Answers

3
votes

The afterPageLoad event is not fired on full or partial refreshes. Try moving your viewScope logic to the beforeRenderResponse event to see if that helps.

But why store the value in viewScope when you have access to it via currentDocument? Also consider using currentDocument.getValue("unid") instead of getItemValueString().

So when you need to use the value, just reference it with currentDocument.getValue("unid").