I need to manipulate the data being submitted via an Umbraco Form. So i've created a custom workflow to do this. The problem I have is that even though I can change the field it's not being saved in the database. Can anyone see what's wrong with this code:-
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
{
try
{
foreach (RecordField rf in record.RecordFields.Values)
{
var fieldValue = rf.ValuesAsString();
rf.Values[0] = EncryptData.Encrypt(rf.ValuesAsString(), "Crypto-key!"); // Crypto-key! = the encryption Key to use, change this!
fieldValue = rf.ValuesAsString();
LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "OUTPUT: " + rf.Values[0]);
}
//If we altered a field, we can save it using the record storage
RecordStorage store = new RecordStorage();
store.UpdateRecord(record, e.Form);
store.Dispose();
LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Record saved with Encryption");
return WorkflowExecutionStatus.Completed;
}
catch (Exception ex)
{
LogHelper.Warn(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, ex.Message);
return WorkflowExecutionStatus.Failed;
}
}
The log file doesn't seem to show any errors, so I can only assume I'm missing some key step.
Update Field Value in Workflow
Hi,
I need to manipulate the data being submitted via an Umbraco Form. So i've created a custom workflow to do this. The problem I have is that even though I can change the field it's not being saved in the database. Can anyone see what's wrong with this code:-
The log file doesn't seem to show any errors, so I can only assume I'm missing some key step.
Many thanks
Paul
is working on a reply...