Question

I'm trying to get a value from a profile document in the beforePageLoad event of my XPage. To do this I use Server Side Javascript:

var currdb:NotesDatabase = database;
var profdoc:NotesDocument = currdb.getProfileDocument("frmProfile","");
var showRefInfo = profdoc.getItemValueString("ShowReferenceInformation");
sessionScope.put("showRefInfo",@Text(showRefInfo));

The field "ShowReferenceInformation" can have a value of either 1 or 0. I have changed this value from 0 to 1, however my SSJS code continues to return 0. What could be causing this?

Was it helpful?

Solution

Profile docs on the web have always been excessively cached, and I believe this is still the case with XPages. Most likely, what you'll see is that some requests will get the new value while others won't until the cache is fully refreshed after some arbitrary amount of time.

OTHER TIPS

I actually like profile documents. However the way to use them is in a synchronized function that checks for an ApplicationScope variable and reads that one. If it is not there load from the profile. Write back immediately. So you super cache it.

To agree with the previous 2 answers. Do not use profile documents in xpages. The cache is refreshed when the HTTP task is refreshed. This is unacceptable in most environments. I would use another method like applicationScope to set those values.

But if you are ok with having to restart HTTP everytime this entry changes then go ahead and use profile docs in xPages...

I agree with Jesse. Caching is usually a big problem with with profile document. When we switched from Notes to XPage Environment we always had the same problem.

The solution is that you could create an simple agent for creating profile documents and then create a view to handle the same.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top