Ever wanted to display the users submission from Umbraco Contour on a Thank You page, but didn't know how to access the API? Well, this post is for you.
This could be adapted as a confirmation page to a PayPal payment form post or simply to let them know that the submission was successful.
Here are the steps:
var approvedRecords = Umbraco.Forms.Mvc.DynamicObjects.Library.GetApprovedRecordsFromFormOnPage(Model.Content.Parent.Id, "YOURFORMGUID");
var submittedRecord = Request.QueryString["recordid"];
if( !String.IsNullOrEmpty(submittedRecord) )
@foreach( var record in approvedRecords )
if( submittedRecord == record.Id )
<em>@record.Created.ToString("dd MMMM yyy")</em>
@foreach( var field in record.RecordFields )
// First, build table rows for non-editable fields
var sThisField = field.Value.Field.Caption;
var sThisValue = field.Value.ValuesAsString();
<p>@sThisField - @sThisValue</p>
That should look something like this:
Now you can modify that to be an invoice, form to post for payment, or whatever you need.
There is a better of doing this
using (var recordStorage = new RecordStorage())
var rec = recordStorage.GetRecord(new Guid(recordId)); //actual form record with data
dynamic record = new DynamicRecord(rec); //get dynamic object for ease of use on display
Thank you Ismail Mayat. Used it.Very useful to me.
Awesome Ismail, thanks!