I am currently using umbraco forms for a quiz on my website. I am currently using a workflow to score the quiz and send send out different emails based on the score. I am trying to use a hidden field I can update in the workflow to save the score but I have not had any success getting the record to change.
This is the code block I am using to try and update the hidden field.
// UPDATE RECORDS TO INCLUDE SCORE
foreach (RecordField recordField in record.RecordFields.Values)
{
if (recordField.Field.Caption == "Score")
{
recordField.Values.Clear();
recordField.Values = new List<object> { "something" };
}
}
Umbraco.Forms.Data.Storage.RecordStorage store = new RecordStorage();
store.UpdateRecord(record, e.Form);
store.Dispose();
I would greatly appreciate any assistance I can get.
I'm struggling to do the same! Did you find a solution to do this ?
Would be nice to share it here?
The best would be to create the field automatically if it doesn't exist.
I think there is a lack of documentation for all those Forms and this is suppose to be a premium package. All docs found are from Countours webforms which was perfectly supported by Tim Geysens.
This is not the first post I am seeing unanswered about Forms.
A bit late for you guys but one for posterity... based on answers for similar topics I think my changes were being overwritten when the form gets Approved automatically. So tick Enable Post Moderation, which leaves the form in a Submitted state rather than Approved, and then Approve it in code after the UpdateRecord.
// set field value
recordField.Values.Clear();
recordField.Values.Add(fieldValue);
// save record
RecordStorage recordStorage = new RecordStorage();
recordStorage.UpdateRecord(record, form);
recordStorage.Dispose();
// set to Approved
var recordService = new Umbraco.Forms.Web.Services.RecordService();
recordService.Approve(record, form);
Update hidden field value from workflow
Hi,
I am currently using umbraco forms for a quiz on my website. I am currently using a workflow to score the quiz and send send out different emails based on the score. I am trying to use a hidden field I can update in the workflow to save the score but I have not had any success getting the record to change.
This is the code block I am using to try and update the hidden field.
I would greatly appreciate any assistance I can get.
Thanks,
Hi,
I'm struggling to do the same! Did you find a solution to do this ? Would be nice to share it here? The best would be to create the field automatically if it doesn't exist.
I think there is a lack of documentation for all those Forms and this is suppose to be a premium package. All docs found are from Countours webforms which was perfectly supported by Tim Geysens. This is not the first post I am seeing unanswered about Forms.
Florent
A bit late for you guys but one for posterity... based on answers for similar topics I think my changes were being overwritten when the form gets Approved automatically. So tick Enable Post Moderation, which leaves the form in a Submitted state rather than Approved, and then Approve it in code after the UpdateRecord.
is working on a reply...