Cant override field's value on a submission after submit #429
-
I need to override the value of a field from a submission of a form on an after-submit event I have this event listener
so on my email, I get the new value I want: but on my stored submissions in the CMS it looks empty: am I doing something wrong? Craft & Plugin Info (please complete the following information):
Additional context |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Sorry for the delay @palomamtnez. Can you see if this works instead? 🙂
|
Beta Was this translation helpful? Give feedback.
-
Hey @kjmartens thanks for getting back to me :) It still has the same behaviour... Code:
Also, does this event, EVENT_AFTER_SUBMIT, work before the CRM integrations? Thanks |
Beta Was this translation helpful? Give feedback.
-
It seems like the best possible approach here would be using the You would have to update the After the data has been updated and persisted, the integrations would kick in and send the data to HubSpot as well as send out the emails. The emails though, depend on how your email template is set up. If it uses the form data, you would also have to update the form data in the event, however, if it's using the submission data, you should be good to go. |
Beta Was this translation helpful? Give feedback.
-
I had to run setFormFieldValues with the second param override false, and then save the submission. Maybe add something about it to the docs? |
Beta Was this translation helpful? Give feedback.
It seems like the best possible approach here would be using the
SubmissionsService::EVENT_AFTER_SUBMIT
event.You would have to update the
submissionUrl
field value for the$submission
element and then re-save the element. There might be an issue while saving using elements service because of all the on-save events triggering, so it could be possible that modifying the value via database directly would be the only viable approach here, but that has to be tested.After the data has been updated and persisted, the integrations would kick in and send the data to HubSpot as well as send out the emails.
The emails though, depend on how your email template is set up. If it uses the form data, …