Sending email didn't create a record in Email object

Version 1


    In certain cases if a parent record has not been saved prior to firing a notification quick action, the outgoing email notification initiated from quick action will failed to be created in the Email object. The actual emails are sent however.

    In this case the logs will show the following message:

    SendMailPostOp[TenantId={tenantID}, UserId={UserID}]: Email sent with the following error(s): DataLayer.PromptException: Exception of type 'DataLayer.PromptException' was thrown.   at DataLayer.ObjectTransaction.Execute(SaveResponseErrors errors, IExecuteAction executeAction, SaveAndActionResponse response)   at SaaS.WebUI.Action.SendEmailActionDef.CreateJournalEmailContext(AfterCommitParams aceParams, SaveAndActionResponse response, ObjectTransaction transaction)   at SaaS.WebUI.Action.SendEmailActionDef.GetJournalEmailContext(AfterCommitAction afterCommitAction, SaveAndActionResponse response)   at SaaS.WebUI.Action.SendEmailActionDef.LogJournalEmail(AfterCommitAction afterCommitAction, SendMailErrorContainer errorContainer, SaveAndActionResponse response, Int32 numberOfTries), Email Contents: {contents}



    This error can be avoided by forcing the system to save the parent record with the notification quick action.  This will in effect ensure the email is never sent or the record is saved (or able to be saved) prior to dispatching the email. 

    1.  Go to the Incident workspace and select Quick Actions.
    2.  Open and Edit the notification QA and check the option to Auto Save.
    3.  Save the quick action.
    4.  Test the functionality by opening a new incident under 2 scenarios:
         a.  Do not fill in all required fields.  Run the QA and you should get a message that required fields are not populated and the notification does not go out.
         b.  Fill in all required fields, run the quick action and the Incident will save, the notification will sned and the proper Activity History etc is attached.