Edit form submission and delay email notification
Hi everyone,
I'm working on a custom functionality that updates some form entry specific fields, based on the current page. I got that part working fine, but the issue is that every admin subscribed to receive new form notifications is getting 2 of them:
- The first one with the manually updated values blank
- The second one with the proper values updated.
At the point of reaching the "FormsEntryCreatedEventHandler" seems to me that the notification is already sent (or queued to be sent: I checked at this table 'sf_notif_cmplt_msg_job' and there's a new entry right before the method starts). I tried disabling the notifications by manually unsubscribing everyone for that form in the "FormSavingEvent" that comes a bit earlier and the entry does not seem to be found in the table, but I'm still getting the first notification as soon as I enter FormsEntryCreatedEventHandler (and also I think that could lead to problems even if that worked if concurrent users submit the form).
The second email is queued because of the "formsManager.SaveChanges();" line and that one sends the proper values.
This is how the global.asax.cs file looks like (partially and simplified)
private void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
if (e.CommandName == "Bootstrapped")
EventHub.Subscribe<IFormEntryCreatedEvent>(evt => FormsEntryCreatedEventHandler(evt));
public void FormsEntryCreatedEventHandler(IFormEntryCreatedEvent eventInfo)
if (eventInfo.FormName != formName) return null;
try
var form = GetForm(eventInfo.FormName);
var entry = GetFormEntry(form, eventInfo.EntryId);
var programField = ;
var degreeField = ;
entry.SetValue("TextFieldController_1", "value 1");
entry.SetValue("TextFieldController_2", "value 2");
formsManager.SaveChanges();
catch (Exception ex)
//uh oh... log this.
Any suggestions?
Thanks in advance