Cannot read property 'editor' of undefined

I wanted to display an error message on a popup and what I did was,

  1. add a page Title component into the popup
  2. gave a unique name to the page title component
  3. in a custom javascript, on click of a button on the popup, used the below mechanism to display the custom message,

var pageTitle = $(‘#searchContacts’);
var editor = pageTitle.data(‘object’).editor;

editor.handleMessages([{message: ‘an error’, severity:‘ERROR’}]);

However this works fine if I logging as an Administrator, The problem is If I logging another user (which doesn’t have some permission to the page title component I guess) It gives me the below error

Uncaugh TypeError: Cannot read property ‘editor’ of undefined

  1. What am I doing wrong here?
  2. Is this really a permission issue?
  3. Is there another way to display the custom js error?

Thanks in advance

Could someone be able to answer this?

What happens if you log in as the “other” user, open Dev Console, and execute the lines

var pageTitle = $(‘#searchContacts’); 
var editor = pageTitle.data(‘object’).editor;


Irvin, Appriciate your help on this,

I did as you said and still getting the same error; please see the attach image to see the error log

Thanks again

The output of var pageTitle seems correct.  What do you get when you type in pageTitle.data(‘object’)?

Maybe it is a permission issue as you suggest with the model associated with the page title.  Have you checked the profiles/perm sets?  I would expect to see another sort of error if this was the case, however.

These sorts of issues are hard for me to diagnose without being hands on.  Maybe other community members can chime in.

Irvin, Thanks for all your support which led me to the right path of debugging the issue. The issue here was I haven’t assign the correct model to the page title and secondly I found that my ‘other’ user doesn’t have access to the Lead record.

Finally, problem solved! Thanks again for your support

Awesome, happy Skuid-ing.