I am making some edits to the code for submitting contour forms RESTfully and I am looking to return the record GUID in the JSON response from the CreateRecord function.
if (numberOfErrors == 0) { var record = recordService.Record; var recordGuid = record.Id; record.IP = userIpAddress; record.UmbracoPageId = nodeId; recordStorage.InsertRecord(record, form);
foreach (var f in recordService.Form.Pages[formStep].FieldSets[0].Fields) { var field = f; var currentFieldValue = fieldValues[field.Caption];
if (GetFieldType(field) == "DatePicker" && string.IsNullOrEmpty(currentFieldValue)) continue;
var key = Guid.NewGuid(); var recordField = new RecordField { Field = field, Key = key, Record = record.Id, Values = new List<object> { currentFieldValue } };
using (var recordFieldStorage = new RecordFieldStorage()) recordFieldStorage.InsertRecordField(recordField);
In the above section of code you can see that if there are no errors it will create a new cord I also set a variable called recordGuid.
the problem is the Guid seems to return 0000-00000-0000-000 (i,e, an empty guid) I have tried tracing this both when the record is created and after it the record service saves form but I still get an empty value.
Empty Record.Id
hey there,
I am making some edits to the code for submitting contour forms RESTfully and I am looking to return the record GUID in the JSON response from the CreateRecord function.
In the above section of code you can see that if there are no errors it will create a new cord I also set a variable called recordGuid.
the problem is the Guid seems to return 0000-00000-0000-000 (i,e, an empty guid) I have tried tracing this both when the record is created and after it the record service saves form but I still get an empty value.
Any ideas?
Cheers
L
SORRY! my bad I wasn't returning the JSON string I thought I was.
Works fine
L
is working on a reply...