Still having this issue. Further investigation has shown that the correct dropdown value is in this table "cmsPropertyData"
The Contour workflow completes ok, and the unpublished node gets created ok. When you first load the unpublished node all the field values are there apart from the dropdown values. Obviously if you then publish the node, it gets saved with empty values.
The dropdowns are a standard Property Editor (Dropdown Lisr) set to Nvarchar.
The Contour Entries view in the backend shows the correct values, so it's only when it creates the unpublished node.
Any ideas?
This is the latest code for getting the dropdown values and saving them.
DocumentType dt = new DocumentType(dtId);
if (dt != null)
{
Document d = Document.MakeNew(nameMapping, dt, new umbraco.BusinessLogic.User(0), root);
foreach (Property p in d.getProperties)
{
try
{
if (mappings.ContainsKey(p.PropertyType.Alias))
{
switch (p.PropertyType.Alias)
{
case "bodyText":
string formattedField = mappings[p.PropertyType.Alias].Replace("\r\n\r\n","<br /><br />").Replace("\r\n","<br />");
p.Value = formattedField;
break;
case "jobDatePosted":
case "jobClosingDate":
CultureInfo ukCulture = new CultureInfo("en-GB");
var date = mappings[p.PropertyType.Alias];
DateTime formattedDateTime = DateTime.Parse(date, ukCulture.DateTimeFormat);
p.Value = formattedDateTime;
break;
case "jobSector":
var sectors = GetPrevalues(1370);
var jobSector = mappings[p.PropertyType.Alias];
if (sectors.ContainsValue(jobSector))
{
var value = sectors.Single(x => x.Value.ToString() == jobSector).Value;
p.Value = "<![CDATA[" + value + "]]>";
//p.Value = value;
}
break;
case "jobArea":
var areas = GetPrevalues(1371);
var jobArea = mappings[p.PropertyType.Alias];
if (areas.ContainsValue(jobArea))
{
var value = areas.Single(x => x.Value.ToString() == jobArea).Value;
p.Value = "<![CDATA[" + value + "]]>";
//p.Value = value;
}
break;
case "jobType":
var types = GetPrevalues(1350);
var jobType = mappings[p.PropertyType.Alias];
if (types.ContainsValue(jobType))
{
var value = types.Single(x => x.Value.ToString() == jobType).Value;
p.Value = "<![CDATA[" + value + "]]>";
//p.Value = value;
}
break;
default:
p.Value = mappings[p.PropertyType.Alias];
break;
}
}
}
catch (Exception ex)
{
LogHelper.Debug(ex.ToString());
}
}
d.Save();
if (Publish == true.ToString())
{
try
{
d.Publish(new umbraco.BusinessLogic.User(0));
library.UpdateDocumentCache(d.Id);
}
catch (Exception ex)
{
LogHelper.Debug(ex.ToString());
}
}
}
return WorkflowExecutionStatus.Completed;
Custom workflow not saving dropdown value
I have a Contour form with a custom workflow that creates a new job node on submission.
The form has a number of dropdown lists, the values of which get saved to the [UFRecordsXml] table OK.
When I check the unpublished node in the tree, all of the dropdown values are missing, and the data is missing from the [cmsPreviewXml] table.
This is the workflow code that creates the new node:
Still having this issue. Further investigation has shown that the correct dropdown value is in this table "cmsPropertyData"
The Contour workflow completes ok, and the unpublished node gets created ok. When you first load the unpublished node all the field values are there apart from the dropdown values. Obviously if you then publish the node, it gets saved with empty values.
The dropdowns are a standard Property Editor (Dropdown Lisr) set to Nvarchar.
The Contour Entries view in the backend shows the correct values, so it's only when it creates the unpublished node.
Any ideas?
This is the latest code for getting the dropdown values and saving them.
Fixed it with the help of this post on stackoverflow
I was trying to save the Text value of the dropdown list and not the ID, nothing to do with Contour.
Snippet of modified code:
Comment author was deleted
Thanks for sharing the solution :)
is working on a reply...