diff --git a/14/umbraco-forms/developer/working-with-data.md b/14/umbraco-forms/developer/working-with-data.md index d54bcaf68da..180959a3a8d 100644 --- a/14/umbraco-forms/developer/working-with-data.md +++ b/14/umbraco-forms/developer/working-with-data.md @@ -77,17 +77,13 @@ Guid UniqueId Dictionary RecordFields ``` -In order to access custom Form fields, these are available in the `RecordFields` property. Furthermore there exists an extension method named `ValueAsString` on `IRecord` in `Umbraco.Forms.Core.Services`, such that you can get the value as string given the alias of the field. - -This extension method handle multi value fields by comma separating the values. E.g. "A, B, C" +To access custom Form fields, call `record.GetValue(alias)` where `T` is the expected field type and `alias` is the alias of the form field. ## Sample razor script Sample script that is outputting comments using a Form created with the default comment Form template. ```csharp -@using Umbraco.Core; -@using Umbraco.Cms.Core.Composing; @using Umbraco.Forms.Core.Services; @inject IRecordReaderService _recordReaderService; @@ -97,15 +93,15 @@ Sample script that is outputting comments using a Form created with the default
  • @record.Created.ToString("dd MMMM yyy") @if(string.IsNullOrEmpty(record.ValueAsString("email"))){ - @record.ValueAsString("name") + @record.GetValue("name") } else{ - @record.ValueAsString("name") + @record.GetValue("name") } said -

    @record.ValueAsString("comment")

    +

    @record.GetValue("comment")

  • }