0

I am getting the following error when trying to make a simple call from the beforeRenderResponse event of an XPage:

Error calling method 'IsLoggedIn()' on an object of type 'object [Javascript Object]'

I can't figure out why it gives me that error, especially when I am not using an object. Here's how I have it working:

XPage BeforeRenderResponse:

ProductFinderInit();   (which is in the SiteSpecific.jss library, and included in resources on XPage)

In SiteSpecific.jss:

import Common;

function ProductFinderInit() {
...
  viewScope.IsLoggedIn = IsLoggedIn();
...

In Common.jss (which is also resource on XPage):

function IsLoggedIn() {
  var userName:NotesName = session.createName(@UserName());
  if (userName.getCommon() === "Anonymous") return false;
  else return true;
}

So it's really a simple call, which is why I'm confused on the error. The really confusing thing is that it doesn't happen every time, only occasionally. Any help would be great!

Ryan C
  • 1
  • 2
  • 1
    try changing this line viewScope.IsLoggedIn =IsLoggedIn() ; to viewScope.put("IsLoggedIn",IsLoggedIn()) – Fredrik Norling Feb 13 '13 at 09:44
  • Can we start putting these suggestions in answers instead of comments so that these questions stop showing up as unanswered, please? – Vic Mar 08 '13 at 16:37

1 Answers1

1

Problem might be that viewScope.IsLoggedIn = IsLoggedIn(); has the same names. Try to change at least one of them.

Also try to write into you methods some try catch with error printing.

Lukas
  • 391
  • 4
  • 11