Foros de discusión

Freemarker : getEvent API

Sourabh Lonikar, modificado hace 6 años.

Freemarker : getEvent API

Junior Member Mensajes: 42 Fecha de incorporación: 14/11/16 Mensajes recientes
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, modificado hace 6 años.

RE: Freemarker : getEvent API

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
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.