ProWorks Blog

How to Display the Submitted Record from Umbraco Contour on the Thank You Page

By  |  Thursday, July 18, 2013  |  , , ,  |  67 comments

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:

1. Create a "Thank You" page under the page that contains your Umbraco form.

Contour-ThankYou

2. In the Settings area set the Thank You page as the new page you just created.

Contour-ThankYouSettings

3. Create a new Razor macro with the following code and allow it to be inserted into the Rich Text Editor

@inherits umbraco.MacroEngines.DynamicNodeContext
@using Umbraco.Forms.Mvc.DynamicObjects
	

    @{
        var approvedRecords = Umbraco.Forms.Mvc.DynamicObjects.Library.GetApprovedRecordsFromFormOnPage(Model.Content.Parent.Id, "YOURFORMGUID");
        var submittedRecord = Request.QueryString["recordid"];
		
		if( !String.IsNullOrEmpty(submittedRecord) )
		{
			<ul>
			@foreach( var record in approvedRecords )
			{
				if( submittedRecord == record.Id )
				{
					<li>
						<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>
						}
		
					</li>
				}
			}
			</ul>
		}
    }

4. Drop the Macro into the Body Text or RTE of your Thank You page that you just created.

Contour-ThankYouMacro

That should look something like this:

Contour-ThankYouResults

Now you can modify that to be an invoice, form to post for payment, or whatever you need.

67 comments for “How to Display the Submitted Record from Umbraco Contour on the Thank You Page”

  1. Posted 7/19/2013 at 2:41:47 AM

    Jason,

    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

    }
    @record.FirstName

    regards

    Ismail

  2. Posted 7/22/2013 at 10:28:54 PM

    Thank you Ismail Mayat. Used it.Very useful to me.

  3. Posted 7/24/2013 at 10:46:21 AM
    Gravatar of Jason

    Awesome Ismail, thanks!

  4. Posted 6/27/2014 at 3:13:31 PM

    Hello!

  5. Posted 6/27/2014 at 3:13:46 PM

    Hello!

  6. Posted 6/27/2014 at 3:13:59 PM

    Hello!

  7. Posted 6/27/2014 at 3:14:14 PM

    Hello!

  8. Posted 6/29/2014 at 11:21:10 AM

    Hello!

  9. Posted 6/29/2014 at 11:21:21 AM

    Hello!

  10. Posted 6/29/2014 at 11:21:32 AM

    Hello!

  11. Posted 6/29/2014 at 11:21:44 AM

    Hello!

  12. Posted 6/29/2014 at 11:21:55 AM

    Hello!

  13. Posted 6/30/2014 at 6:13:05 AM

    Hello!

  14. Posted 6/30/2014 at 6:13:18 AM

    Hello!

  15. Posted 6/30/2014 at 6:13:30 AM

    Hello!

  16. Posted 6/30/2014 at 6:13:42 AM

    Hello!

  17. Posted 7/1/2014 at 6:07:39 PM

    Hello!

  18. Posted 7/1/2014 at 6:07:52 PM

    Hello!

  19. Posted 7/1/2014 at 6:08:04 PM

    Hello!

  20. Posted 7/1/2014 at 6:08:16 PM

    Hello!

  21. Posted 7/2/2014 at 3:43:08 PM

    Hello!

  22. Posted 7/2/2014 at 3:43:19 PM

    Hello!

  23. Posted 7/2/2014 at 3:43:31 PM

    Hello!

  24. Posted 7/2/2014 at 3:43:42 PM

    Hello!

  25. Posted 7/2/2014 at 3:43:53 PM

    Hello!

  26. Posted 7/2/2014 at 8:40:22 PM

    Hello!

  27. Posted 7/2/2014 at 8:40:38 PM

    Hello!

  28. Posted 7/2/2014 at 8:40:54 PM

    Hello!

  29. Posted 7/2/2014 at 8:41:10 PM

    Hello!

  30. Posted 7/4/2014 at 4:07:24 AM

    Hello!

  31. Posted 7/4/2014 at 4:07:37 AM

    Hello!

  32. Posted 7/4/2014 at 4:07:51 AM

    Hello!

  33. Posted 7/4/2014 at 4:08:05 AM

    Hello!

  34. Posted 7/4/2014 at 4:08:19 AM

    Hello!

  35. Posted 7/4/2014 at 9:41:49 PM

    Hello!

  36. Posted 7/4/2014 at 9:42:00 PM

    Hello!

  37. Posted 7/4/2014 at 9:42:11 PM

    Hello!

  38. Posted 7/4/2014 at 9:42:22 PM

    Hello!

  39. Posted 7/5/2014 at 12:35:31 AM

    Hello!

  40. Posted 7/5/2014 at 12:35:42 AM

    Hello!

  41. Posted 7/5/2014 at 12:35:52 AM

    Hello!

  42. Posted 7/5/2014 at 12:36:03 AM

    Hello!

  43. Posted 7/5/2014 at 12:36:14 AM

    Hello!

  44. Posted 7/5/2014 at 9:08:27 AM

    Hello!

  45. Posted 7/5/2014 at 9:08:40 AM

    Hello!

  46. Posted 7/5/2014 at 9:08:52 AM

    Hello!

  47. Posted 7/5/2014 at 9:09:05 AM

    Hello!

  48. Posted 7/5/2014 at 4:42:20 PM

    Hello!

  49. Posted 7/5/2014 at 4:42:34 PM

    Hello!

  50. Posted 7/5/2014 at 4:42:47 PM

    Hello!

  51. Posted 7/5/2014 at 4:43:00 PM

    Hello!

  52. Posted 7/6/2014 at 11:30:06 AM

    Hello!

  53. Posted 7/6/2014 at 11:30:26 AM

    Hello!

  54. Posted 7/6/2014 at 11:30:44 AM

    Hello!

  55. Posted 7/6/2014 at 11:31:02 AM

    Hello!

  56. Posted 7/8/2014 at 9:36:00 PM

    Hello!

  57. Posted 7/8/2014 at 9:36:12 PM

    Hello!

  58. Posted 7/8/2014 at 9:36:24 PM

    Hello!

  59. Posted 7/8/2014 at 9:36:35 PM

    Hello!

  60. Posted 7/14/2014 at 4:01:09 PM

    Hello!

  61. Posted 7/14/2014 at 4:01:25 PM

    Hello!

  62. Posted 7/14/2014 at 4:01:40 PM

    Hello!

  63. Posted 7/14/2014 at 4:01:54 PM

    Hello!

  64. Posted 7/18/2014 at 8:16:48 AM

    Hello!

  65. Posted 7/18/2014 at 8:17:00 AM

    Hello!

  66. Posted 7/18/2014 at 8:17:13 AM

    Hello!

  67. Posted 7/18/2014 at 8:17:26 AM

    Hello!

Post a comment