November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Uday,
You can use IFormDataRepository (inside EPiServer.Forms.Core.Data namespace) to get submitted data:
List<Submission> submittedData = _formDataRepository.GetSubmissionData( new FormIdentity(formGuid, languageBranch), DateTime.Now.AddDays(-100), DateTime.Now).ToList();
Hi Dejan Caric,
Thanks for your replying, I tried your sample code but in formidentity i didn't get language from form identity. Could you please see below code for my code
private Injected<IFormRepository> _formRepository;
public ActionResult Index(FormPageType currentPage)
{
FormDataRepository _formDataRepository = new FormDataRepository();
var formsInfo = _formRepository.Service.GetFormsInfo(null);
/* Implementation of action. You can create your own view model class that you pass to the view or
* you can pass the page type for simpler templates */
foreach (var info in formsInfo)
{
List<Submission> submittedData = _formDataRepository.GetSubmissionData(
new FormIdentity(info.FormGuid, info.language),
DateTime.Now.AddDays(-100),
DateTime.Now).ToList();
}
return View(currentPage);
}
I tried above code but i got info.language is not getting from form identity class. Could you please help me how to solve this?
Thanks,
Uday
Hi Uday,
I guess you want to get a form data in the language of the current page, so you can try with currentPage.LanguageBranch.
Btw, formRepository.GetFormsInfo doesn't return all forms. It's better to iterate trough filtered ContentArea items and look for FormContainerBlocks.
Hi Dejan,
Thanks for your reply it's working well, But i have one more question i'e i have four records in my submitted data, i want to fetch that submited data. How can i do this could you plese help me?
I tried something like this plese find below;
Index View Code
@if (ViewBag.Getdata.Count > 0)
{
<table>
<tr>
<th>Name</th>
<th>Address</th>
</tr>
@for (int i = 0; i <= ViewBag.Getdata.Count; i++)
{
foreach (EPiServer.Forms.Core.Models.Submission pair in ViewBag.Getdata)
{
{
<tr>
<td>pair.Key</td>
<td>pair.Value</td>;
</tr>
}
}
}
</table>
}
Controller Code
List<Submission> submittedData;
private Injected<IFormRepository> _formRepository;
public ActionResult Index(GetPage currentPage)
{
FormDataRepository _formDataRepository = new FormDataRepository();
var formsInfo = _formRepository.Service.GetFormsInfo(null);
foreach (var info in formsInfo)
{
submittedData = _formDataRepository.GetSubmissionData(
new FormIdentity(info.FormGuid, currentPage.LanguageBranch),
DateTime.Now.AddDays(-100),
DateTime.Now).ToList();
ViewBag.Getdata = submittedData;
Thanks & Regards,
Uday.
I want to mapp custom Page Type Input Fields with Microsoft Dynamics CRM fields to pass data from Episerver to CRM as is happing in case of Episerver Forms.
How can i do this please help.
Thanks!
Aqib - There are connectors available to use with marketing Automation add-on to send data directly to CRM
See Episerver market place https://marketplace.episerver.com/apps/episerver/connect-for-microsoft-dynamics-crm/
Dear all,
I want to display submitted form data in page programetically . i want code for form submitted data
Thanks®ard
Uday