Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Send Liferay User Notification for web content creation.
Hello Folks,
Can anyone suggest an approach for the below-mentioned requirement?
I have one structure in Liferay named news-letter now whenever any web content has been created or updated using that structure I want to send a notification to the specific users with one role named as staff in Liferay 7.4.
How should we achieve this in Liferay 7.4?
I really appreciate any help you can provide.
Possibly a hack, not sure:
Add a workflow that has a condition--check the structure Id. If it's the structure you need a notification for, transition to a state node that has two jobs: send a notification and transition the item to the end state (where you should makr the item as approved). If it's not the structure you're interested in, just transition directly to the end state node (where you mark the item as approved).
Condition could look something like this:
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.journal.service.JournalArticleLocalServiceUtil;
import com.liferay.journal.model.JournalArticle;
import com.liferay.portal.kernel.util.*;
long id = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
JournalArticle ja = JournalArticleLocalServiceUtil.getJournalArticle(id);
if (ja.getDDMStructureId() == 34888) {
returnValue = "fe262ad3-1b44-42d3-b790-f5c23679492a";
}
else {
returnValue = "09ef78d1-daab-4d5b-81c0-bb92f92435c8";
}
Powered by Liferay™