Message Boards

Question about Forms

Shin Chan, modified 2 Years ago.

Question about Forms

New Member Posts: 9 Join Date: 2/15/17 Recent Posts

We have a custom portlet which is a simple 10 field FORM, information submitted is captured and saved into a PDF document and emailed to predefined recipient using custom code.

When migrating to latest version (7.2+), we are thinking of using Liferay Forms ( https://help.liferay.com/hc/en-us/articles/360017894612-Introduction-to-Forms ) as much as possible. Creating the form is simple, but no idea how/if we can capture the data, generate PDF document, and email it.

Any ideas/input will be helpful. Thank you.

thumbnail
Russell Bohl, modified 2 Years ago.

RE: Question about Forms

Expert Posts: 289 Join Date: 2/13/13 Recent Posts

It sounds like you could use a Model Listener for this, on the DDMFormInstanceRecordVersion.

You'd want to override the onAfterCreate method. In it you'll need to check if the newly created form record was submitted for the form you want to inject logic on. Then, check if the status of the record is approved. Then, inject your business logic for creating the PDF and sending the email.

If onAfterCreate doesn't seem to be working all the time, you might also need to put the same logic into onAfterUpdate. This is because the forms system has an autosave feature, so when the user clicks submit it might either be a create or and update in the backend.

There's a very similar discussion going on in Liferay's community slack, by the way. Go here to join the slack worskpace if you aren't already in there.
 

Shin Chan, modified 2 Years ago.

RE: RE: Question about Forms

New Member Posts: 9 Join Date: 2/15/17 Recent Posts

Thank you Russell. I will try your solution.