Friday, November 6, 2015

Using Add Contact to contact List WFFM Save Action with Sitecore 8

Yesterday, I saw a question posted into Sitecore Community form related to "Add Contact to Contact List" WFFM save action.

The issue was, when "Add the contact to a contact list" save action was used in a WFFM form.



when the user submits the form, he receives following error message in the page.

We experienced a technical difficulty while processing your request. Your data may not have been correctly saved.



And when checked in the error logs, we can see following error message

11668 09:38:20 WARN  Null ids are not allowed.
Parameter name: userName
Exception: System.ArgumentNullException
Message: Null ids are not allowed.
Parameter name: userName
Source: Sitecore.Kernel
   at Sitecore.Security.Accounts.User.FromName(String userName, Boolean isAuthenticated)
   at Sitecore.Form.Submit.AddContactToContactList.Execute(ID formid, AdaptedResultList fields, Object[] data)
   at Sitecore.Form.Core.Submit.SubmitActionManager.ExecuteSaving(ID formID, ControlResult[] list, ActionDefinition[] actions, Boolean simpleAdapt, ID sessionID)

11668 09:38:20 WARN  The 'Add Contact to Contact List[id={C5E1D916-2476-4BE4-AE90-7B419B55C9E1}]' save action failed: We experienced a technical difficulty while processing your request. Your data may not have been correctly saved.
11668 09:38:20 WARN  Web Forms for Marketers: an exception: We experienced a technical difficulty while processing your request. Your data may not have been correctly saved. has occured while trying to execute an action.

Then, I tried to add "Create User" save action into the WFFM form Save actions as shown below



And then when try to fill the form and submit it, it worked.  :-)



Reason for this is, to add a user into a Contact List using "Add contact to Contact List", he should be already created in Sitecore as a user.

Update : User is now added into Contact List



Will dig deep into code how and why this happens in a later blog post.

Happy Sitecore :-)


5 comments:

  1. Hi Chaturanga,
    I followed the step given in your blog, However i can't see the EMAIL, FIRSTNAME and LastName is empty.
    However when i export the data in excel sheet, I can see the Email in the Identifier columns.
    Can you tell me how did you map it.
    Regards,
    Amit Thakur

    ReplyDelete
    Replies
    1. Hi Amit,
      I didn't understan what you mean by "However i can't see the EMAIL, FIRSTNAME and LastName is empty."
      If you are talking about mapping fields in "Create User" save action, "Form Fields" are from your WFFM form and "User Profile" are from sitecore user's profile fields.

      Delete
  2. Thanks for the post but is there a better approach of saving to the contact list without creating user's in sitecore.

    ReplyDelete
    Replies
    1. Hi Praveen,
      Thank you for the comment. Please feel free to share that with us.
      It will be helpful to someone who reads this article in future.

      anyway, by the time of writing this article, there were no way we could achieve this ( I have contacted Sitecore support also on this and there suggestions was the same )

      Delete
  3. Hi Chaturanga,

    I have some queries related to Form Report. Once of my clients have raised a Form Report Accuracy stating that the Successful Submission entry count and Export the data to Excel, the record count does not match. For Example, after we Export to Excel the entry is 517, but the Successful Submission shows only 393 entries. Please let me know your thoughts if anything needs to be fixed from my end.

    Thanks,
    Aakash Sinha

    ReplyDelete