I have added a hidden field with the caption "Link" who's value I would like to adjust upon the form being submitted. It is my understanding that the below code should replace whatever form data is submitted with the value of "test", however no entry values are changed.
Just a note that I purposely commented out my if statement for debugging purposes.
I would be very thankful if someone pointed me in the right direction.
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e) {
// update the existing record to include the link foreach (RecordField recordField in record.RecordFields.Values) { //if (recordField.Field.Caption == "Link") //{ recordField.Values.Clear(); recordField.Values = new List<object> { "test" }; //} }
Umbraco.Forms.Data.Storage.RecordStorage store = new RecordStorage(); store.UpdateRecord(record, e.Form); store.Dispose();
Tim, thanks for your response. I do not want an approval process in my workflow as it would defeat the automative purpose of what I'm trying to accomplish with the form.
Just as a side note (not directed at you), but extending Contour has been an uphill battle. No current tutorials work out of the box without modification on VS12.
Well if you make sure the form isn't set to manual approval it should auto approve, placing it on that step will make sure it get's executed as the final thing
Updating field value via custom workflow
I have added a hidden field with the caption "Link" who's value I would like to adjust upon the form being submitted. It is my understanding that the below code should replace whatever form data is submitted with the value of "test", however no entry values are changed.
Just a note that I purposely commented out my if statement for debugging purposes.
I would be very thankful if someone pointed me in the right direction.
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
{
// update the existing record to include the link
foreach (RecordField recordField in record.RecordFields.Values)
{
//if (recordField.Field.Caption == "Link")
//{
recordField.Values.Clear();
recordField.Values = new List<object> { "test" };
//}
}
Umbraco.Forms.Data.Storage.RecordStorage store = new RecordStorage();
store.UpdateRecord(record, e.Form);
store.Dispose();
}
Comment author was deleted
Could you try placing it on the approved workflow state
Tim, thanks for your response. I do not want an approval process in my workflow as it would defeat the automative purpose of what I'm trying to accomplish with the form.
I also noted your response on the similar forum topic from years ago found at http://our.umbraco.org/forum/umbraco-pro/contour/23261-Update-field-values-in-workflow-
However, like them I either misunderstood the documentation, or it is indeed a bug. My code reference came from the official docs at http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Extending-Contour/Adding-a-Workflowtype
Just as a side note (not directed at you), but extending Contour has been an uphill battle. No current tutorials work out of the box without modification on VS12.
Comment author was deleted
Hey Mike,
Well if you make sure the form isn't set to manual approval it should auto approve, placing it on that step will make sure it get's executed as the final thing
Thanks Tim, that did the trick.
is working on a reply...