Forums de discussion
getUserByScreenName in javascript gives a 'cannot call method 'stringily''
Mirko Pelgrom, modifié il y a 10 années.
getUserByScreenName in javascript gives a 'cannot call method 'stringily''
New Member Envoyer: 1 Date d'inscription: 24/05/13 Publications récentes
Hi all,
I'm trying to create a simple functionality using the Web Content Display portlet and javascript as a test.
In de code part of the editor I paste:
<script src="/html/js/liferay/service.js" language="JavaScript"> </script>
<script>
var userScreenName = "m.pelgrom";
var companyId = themeDisplay.getCompanyId();
var userId = themeDisplay.getUserId();
document.write("<p>userScreenName: " + userScreenName + "</p>");
document.write("<p>companyId: " + companyId + "</p>");
document.write("<p>userId: " + userId + "</p>");
var userName = Liferay.Service.Portal.User.getUserByScreenName(companyId, userScreenName);
document.write("<p>userName: " + userName + "</p>");
</script>
The output is:
When I look in development view in Chrome I see the message:
I'm a bit stuck here, is there anything else I need to include? Where can I find more information on using WCD & javascript.
LifeRay 6.0
NOTE: I am restricted to WCD & javascript, cannot use a java solution.
I'm trying to create a simple functionality using the Web Content Display portlet and javascript as a test.
In de code part of the editor I paste:
<script src="/html/js/liferay/service.js" language="JavaScript"> </script>
<script>
var userScreenName = "m.pelgrom";
var companyId = themeDisplay.getCompanyId();
var userId = themeDisplay.getUserId();
document.write("<p>userScreenName: " + userScreenName + "</p>");
document.write("<p>companyId: " + companyId + "</p>");
document.write("<p>userId: " + userId + "</p>");
var userName = Liferay.Service.Portal.User.getUserByScreenName(companyId, userScreenName);
document.write("<p>userName: " + userName + "</p>");
</script>
The output is:
userScreenName: m.pelgrom
companyId: 10132
userId: 444173
When I look in development view in Chrome I see the message:
Uncaught TypeError: Cannot call method 'stringify' of undefined everything.jsp:3
Liferay.Service.getParameters everything.jsp:3
Liferay.Service.ajax everything.jsp:3
h everything.jsp:3
(anonymous function)
I'm a bit stuck here, is there anything else I need to include? Where can I find more information on using WCD & javascript.
LifeRay 6.0
NOTE: I am restricted to WCD & javascript, cannot use a java solution.