Fórum

Workflow - Notification to asset creator on a new discussion message

Daniel Aschauer, modificado 10 Anos atrás.

Workflow - Notification to asset creator on a new discussion message

Junior Member Postagens: 39 Data de Entrada: 22/10/12 Postagens Recentes
Hi!
I am working on my workflow definitions and wonder how a can assign tasks, or write notifications for/to the user who originally created an asset, when a new discussion message (comment) was added by another user?
As far as I understand I only have <user> and <roles> available for asignment and notifications.
Thanks for any hints!
Daniel
thumbnail
Bart Simpson, modificado 10 Anos atrás.

RE: Workflow - Notification to asset creator on a new discussion message

Liferay Master Postagens: 522 Data de Entrada: 29/08/11 Postagens Recentes
Haven't tried with workflow, ,butI can give you more insight how to do it with model listener.
Daniel Aschauer, modificado 10 Anos atrás.

RE: Workflow - Notification to asset creator on a new discussion message

Junior Member Postagens: 39 Data de Entrada: 22/10/12 Postagens Recentes
There is a related forum entry discussing sending notifications to scripted users, which suggest solution if no assignment would be involved:

http://www.liferay.com/community/forums/-/message_boards/message/10858996

In my case now I use an assignment and a related notification. I created a scripted-assignment to assign a task to the owner of the original assets. That is my code, note that it will only work with comments:

		<assignments>
  			<scripted-assignment>
				<script><![CDATA[
				import com.liferay.portal.model.User;
				import com.liferay.portal.service.UserLocalServiceUtil;
				import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
				import com.liferay.portlet.messageboards.model.MBMessage;
				import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
				
				MBMessage message = MBMessageLocalServiceUtil.getMBMessage(Long.parseLong(entryClassPK));
				long authorId = AssetEntryLocalServiceUtil.getEntry(message.getClassName(),message.getClassPK()).getUserId();

				user = UserLocalServiceUtil.getUser(authorId);
				]]></script>
	    		<script-language>beanshell</script-language>
			</scripted-assignment>
		</assignments>