掲示板

Freemarker : getEvent API

6年前 に Sourabh Lonikar によって更新されました。

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
6年前 に Andrew Jardine によって更新されました。

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.