I'm trying to update a field value on a partially submitted form, using a custom workflow in Contour 3.0.18. The workflow is set to execute when the form has been PartiallySubmitted.
The record field type I'm trying to update is of HiddenField.
It is updating the value (I've attached a debugger and can see the record field value is being modified) but it doesn't persist it to the database.
I've compared this code with an example on Tim's blog, and apart from the fact that he's creating a new instance of a Form and I'm using the instance passed in the Event Args, it's the same. However, I've also tried creating a new instance of a form and that doesn't work either.
Any reason you are adding this to the partially submitted? generally when updating record values I recommend to do this on the approved stage (so final stage) to avoid conflicts
It's part of a multi-step application form that has resume functionality. I need to add this after the very first step is submitted so the applicant can abandon the form and then resume later.
Ok seems it's due to the fact that the record is being passed as a value and not as a reference, so the changes will be overwritten, looking into a fix
Been trying different things but always end up with breaking changes so can't introduce that in Contour at this point :( what I would suggest is that you just create an extra table and store your extra record details in that one (linking it to the record id)
I got the same issue. I want to update the record with the currentUmbracoPage informations on submit.
But it won't update the record and if i get the record to udate, it crashes the server.
Dont update this way as i though it would.
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
{
record.GetRecordField("Aktivitet").Values.Clear();
record.GetRecordField("Aktivitet").Values.Add("1, aktivitet");
var fs = new FormStorage();
var form = fs.GetForm(record.Form);
var rs = new RecordStorage();
rs.UpdateRecord(record, form);
rs.UpdateRecordXml(record, form);
fs.Dispose();
rs.Dispose();
return WorkflowExecutionStatus.Completed;
}
Updates the record field if not set to manuelly approve submitted records. If i want to manuelly approve the records, it wont save it to the fields, but it sends the field data that is not set with the currect value in a mail.
Issue programmatically updating record fields
Hi,
I'm trying to update a field value on a partially submitted form, using a custom workflow in Contour 3.0.18. The workflow is set to execute when the form has been PartiallySubmitted.
This is my code:
The record field type I'm trying to update is of HiddenField.
It is updating the value (I've attached a debugger and can see the record field value is being modified) but it doesn't persist it to the database.
I've compared this code with an example on Tim's blog, and apart from the fact that he's creating a new instance of a Form and I'm using the instance passed in the Event Args, it's the same. However, I've also tried creating a new instance of a form and that doesn't work either.
Any ideas?
Greg.
Comment author was deleted
Any reason you are adding this to the partially submitted? generally when updating record values I recommend to do this on the approved stage (so final stage) to avoid conflicts
It's part of a multi-step application form that has resume functionality. I need to add this after the very first step is submitted so the applicant can abandon the form and then resume later.
Greg.
Comment author was deleted
Ok will do a test run and see why the value is being overwritten, more details later today
Cool. Thanks for looking into it.
Comment author was deleted
Looking at the code... manipulating the record should do the trick, trying to debug now, hopefully I'll have a solution for you today
Comment author was deleted
Ok seems it's due to the fact that the record is being passed as a value and not as a reference, so the changes will be overwritten, looking into a fix
Top man, look forward to it. Basically got this whole implementation working, just need this and I'm done :)
Comment author was deleted
Ah the pressure :p hope to get a solution for you tomorrow, stay tuned!
Comment author was deleted
Been trying different things but always end up with breaking changes so can't introduce that in Contour at this point :( what I would suggest is that you just create an extra table and store your extra record details in that one (linking it to the record id)
Would that work as a workaround for you?
Ah, OK, I'll look into a workaround. Thanks for trying.
Greg.
I got the same issue. I want to update the record with the currentUmbracoPage informations on submit.
But it won't update the record and if i get the record to udate, it crashes the server.
Dont update this way as i though it would.
Update the record, but crashes the server
Updates the record field if not set to manuelly approve submitted records. If i want to manuelly approve the records, it wont save it to the fields, but it sends the field data that is not set with the currect value in a mail.
I will make a new post about this. its urgent for me..
HI Bo Jacobsen, I'm having the same issues. Where you able to resolve this?
This works for me
Thanks
is working on a reply...