I'm trying to tie several forms, each connected to its own database table, together using a common key. I have access to the key in my workflow, but can't find a good way to get the key written along with the rest of the form fields.
Here's what I'm doing inside my workflow:
List<object> l = new List<object>(); foreach (RecordField f in record.RecordFields.Values) { if (f.Field.DataSourceFieldKey.ToString() == "keyID") { l.Add(keyId); f.Values = l; } }
Umbraco.Forms.Data.Storage.RecordStorage store = new RecordStorage(); store.UpdateRecord(record, e.Form); store.Dispose();
This all seems to work, but when I look in the DB, the value entered in the web field is written, rather than my new value.
Ideally, I'd like to set this keyId field to a throw-away, default value so the user won't see it (rather, I don't have to hide it via CSS), but in that case it doesn't show up in the list of fields under record.RecordFields.
Any idea what I'm doing wrong here, or thoughts for a better approach?
Manipulating form fields programmatically
I'm trying to tie several forms, each connected to its own database table, together using a common key. I have access to the key in my workflow, but can't find a good way to get the key written along with the rest of the form fields.
Here's what I'm doing inside my workflow:
This all seems to work, but when I look in the DB, the value entered in the web field is written, rather than my new value.
Ideally, I'd like to set this keyId field to a throw-away, default value so the user won't see it (rather, I don't have to hide it via CSS), but in that case it doesn't show up in the list of fields under record.RecordFields.
Any idea what I'm doing wrong here, or thoughts for a better approach?
Comment author was deleted
Hi Selah,
Can't you simply use the record id as the common key?
I'm using multiple forms, and thus, multiple records need to be linked.
is working on a reply...