1
votes

I defined "dbProfileDoc" as global variable for database profile in ssjs library. I have managed to get database profile and dbProfileDoc.getItemValue(fieldname) is working at AfterPageLoad event. However, I got exception thrown out when trying to dbProfileDoc.getItemValue(fieldname) at Submit button to submit my xpages. The dbProfileDoc is still alive but could not access any field value on submit. Is anyone please tell me what is happening?

1
Then I tried to get database profile again: dbProfileDoc = database.getProfileDocument("DatabaseProfile", "DatabaseProfile"); It worked!!! It come to my conclusion that we could not store NotesDocument object to ssjc global variable. The question is that how come dProfielDoc object is not equal to null when tested.Dragon Chow

1 Answers

3
votes

Notes objects can't be stored in a variable for so long because they are not serializable. You should store the values from Notes objects you need in variables and recycle the Notes objects right after it.

As an alternative, you can define your profile document as an additional data source for your XPage. Then you don't have to reread it every time you need it.