We are using Umbraco 7.1.4 and contour 3.0.21, our form is vanilla with 5 fields made up of text and select boxes.
Use ajax to post the form to a webservice, we then pass the current HttpContext through to the CreateRecord methods (to which we added a HttpContext parameter)
The error is on recordService.Submit() An unhandled execption occurs: {"Object reference not set to an instance of an object."}
The logs returned curiously unrelated information:
We didnt solve the issue but we worked around it by using the GUI to deleted the default 'send email' workflow. With the workflow deleted our code works and form data submits without error.
For anyone who is encountering this error while trying to use the SubmitContourForm.cs under Umbraco 7 the recordService.Submit() fails when a Submit() workflow is attached because the record.MemberKey value is never set and is null. If you add record.MemberKey = ""; at around line 134 with the similar record value declarations the recordService.Submit() will no longer return an exception and it will execute the Workflows defined for Submit.
record submit causing error/bug?
We have found an unexpected error/bug (and a work arround) when using code to submit records to a Contour Form.
The code we are using is this:
http://contourcontrib.codeplex.com/SourceControl/latest#Contour.Contrib/Cultiv.RestContour/SubmitContourForm.cs
with a small tweek, we replace var currentFieldValue = HttpContext.Current.Request[field.Caption] ?? ""; with var currentFieldValue = HttpContext.Current.Request[field.Id.toString()] ?? "";
We are using Umbraco 7.1.4 and contour 3.0.21, our form is vanilla with 5 fields made up of text and select boxes.
Use ajax to post the form to a webservice, we then pass the current HttpContext through to the CreateRecord methods (to which we added a HttpContext parameter)
The error is on recordService.Submit() An unhandled execption occurs: {"Object reference not set to an instance of an object."}
The logs returned curiously unrelated information:
2014-06-16 10:43:23,981 [6] ERROR umbraco.presentation.publishingService - [Thread 382] Error executing scheduled publishing
System.Data.SqlClient.SqlException (0x80131904): The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at System.Data.SqlClient.SqlDataReader.Read()
at Umbraco.Core.Persistence.Database.<Query>d__1c`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Umbraco.Core.Persistence.Repositories.ContentRepository.<PerformGetByQuery>d__24.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at umbraco.presentation.publishingService.CheckPublishing(Object sender)
ClientConnectionId:a6b32f1d-bf5f-4e01-9a58-7757ad9f857c
We didnt solve the issue but we worked around it by using the GUI to deleted the default 'send email' workflow. With the workflow deleted our code works and form data submits without error.
We love umbraco 7 :)
For anyone who is encountering this error while trying to use the SubmitContourForm.cs under Umbraco 7 the recordService.Submit() fails when a Submit() workflow is attached because the record.MemberKey value is never set and is null. If you add
record.MemberKey = "";
at around line 134 with the similar record value declarations the recordService.Submit() will no longer return an exception and it will execute the Workflows defined for Submit.is working on a reply...