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: RE: Question about Forms
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.
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.
Thank you Russell. I will try your solution.
Powered by Liferay™