Ryan C
Ryan C

Reputation: 1

Xpages javascript object error calling simple function

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!

Upvotes: 0

Views: 1100

Answers (1)

Lukas
Lukas

Reputation: 402

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.

Upvotes: 1

Related Questions