Search code examples
liferayliferay-7

Liferay 7.1 : call a javascript function after create journal article (web content)


I link my web content (journal article) with a custom table nammed 'ArticleZone'. I add in the edit_article.jsp a dropdown list to link an article to a zone.

Then, i need to save my 'ArticleZone' when i save the web content. I need to save it after the save of the web content because i need its ID.

Can i overpass the function of saving a journal article ?

How can i do that ? Any ideas ?

I've tested javascript call but my web content has not been saved before the javascript was called.

Thanks


Solution

  • You can do it with a Service wrapper.

    See https://dev.liferay.com/en/develop/tutorials/-/knowledge_base/7-0/customizing-liferay-services-service-wrappers

    With a service wrapper class that override JournalArticleServiceWrapper you can redefine main addArticle method.

    In the body, after the super.addArticle(...) call you can invoke your custom save. Use the serviceContext parameter to inject custom data.