留言板

Freemarker : getEvent API

Sourabh Lonikar,修改在6 年前。

Freemarker : getEvent API

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
Hi All,
I am trying to retrieve event using CalEventLocalService API. I am using below code but getting error:

Code : <#assign calEventLocalService= serviceLocator.findService("com.liferay.portlet.calendar.service.CalEventLocalService") />
<#assign calEvent1 = calEventLocalService.getEvent(curEntry.classPK) />

Freemarker Error:
Error on line 44, column 5 in 10155#10195#169551
calEventLocalService.getEvent(curEntry.classPK) is undefined.
It cannot be assigned to calEvent1

How should i get event using API ?

Regards,
Sourabh
thumbnail
Andrew Jardine,修改在6 年前。

RE: Freemarker : getEvent API

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
Hi Sourabh ,

The calendar API is part of a portlet, not the core product so when you are using the Service Locator, you need to use the method with two arguments .. one for the service and the second that specified the servlet context where the service can be found.

public Object findService(String servletContextName, String serviceName)


The way I see your code right now, you are trying to get a handle on the service but it can't find it. So your service reference is likely a null.