Message Boards

How can I send a "Publish Request" programmatically?

Maria Z, modified 2 Years ago.

How can I send a "Publish Request" programmatically?

New Member Posts: 5 Join Date: 10/20/21 Recent Posts

Hey!

I was trying to create a button that updates the content of a JournalArticle, with status = 1 (pending) and send a publication request to the administrator of the portal. I'm trying to use workflow but I don't get results :(

Can anyone helps me?

thumbnail
Olaf Kock, modified 2 Years ago.

RE: How can I send a "Publish Request" programmatically?

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

Why don't you share what you have so far? It might be something that can be spotted within the workflow.

Describe what you do, what you expect and what you observe (and where the difference is). That might make it easier to point to the problem, rather than posting a whole new solution from scratch that might (or might not) fit your environment.

Maria Z, modified 2 Years ago.

RE: RE: How can I send a "Publish Request" programmatically?

New Member Posts: 5 Join Date: 10/20/21 Recent Posts

Hey! I finally discovered that this line solves everything:

WorkflowHandlerRegistryUtil.startWorkflowInstance(themeDisplay.getCompanyId(), newEntry.getGroupId(), themeDisplay.getUserId(), JournalArticle.class.getName(), newEntry.getId(), newEntry, serviceContext);

But, anyways, thank you very much! I was trying to create an entry in the table WorkflowInstanceLink and I encountered some problems with Kaleo, but with this line of code all entries are generated and there is no problem :)