{"title":"FieldRef.Class() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-class-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/fieldref/fieldref-class-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/fieldref/fieldref-class-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Gets the value of the FieldClass Property of the field that is currently selected.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":197,"chars":114},{"level":2,"title":"Parameters","slug":"parameters","at":311,"chars":97},{"level":2,"title":"Return Value","slug":"return-value","at":408,"chars":60},{"level":2,"title":"Remarks","slug":"remarks","at":468,"chars":503},{"level":2,"title":"Example 1","slug":"example-1","at":971,"chars":321},{"level":2,"title":"Example 2","slug":"example-2","at":1292,"chars":424},{"level":2,"title":"Related information","slug":"related-information","at":1716,"chars":136}],"text":"> Version: _Available or changed with runtime version 1.0._\nGets the value of the FieldClass Property of the field that is currently selected. This method returns an error if no field is selected.\n## Syntax\n```al\nClass :=   FieldRef.Class()\n```\n> NOTE\n> This method can be invoked using property access syntax.\n## Parameters\nFieldRef\nType: fieldref-data-type\nAn instance of the fieldref-data-type data type.\n## Return Value\nClass\nType: ../fieldclass/fieldclass-option\n## Remarks\nThe FieldRef refers to the field that you are interested in.\nThe Class method returns the class as an Option. However, you cannot assign the class to an Option variable directly. Instead, you must use the ../system/system-evaluate-method. The Evaluate method has a variable parameter to which the value is assigned and a string parameter. You use the Format method to convert the result of the FieldRef.Class method to Text, and then use the Evaluate method to convert the Text to an Option.\n## Example 1\nIn this example, the return value of the Class method is converted to Text and then converted to an Option. The value of the OptionString property of OptionVar is Normal,FlowFilter,FlowField.\n```al\nvar\n    OptionVar: Option;\n    FldRef: FieldRef;\nbegin\n    Evaluate(OptionVar,Format(FldRef.Class));\nend;\n```\n## Example 2\nIn this example, the return value of the Class method is converted to Text and then converted to an Option. This example uses the Field virtual table instead of an Option variable. The Field virtual table has a Class field, which is an Option and already has the correct OptionString.\n```al\nvar\n    FieldRec: Record Field;\n    FldRef: FieldRef;\nbegin\n    Evaluate(FieldRec.Class,Format(FldRef.Class));\nend;\n```\n## Related information\nfieldref-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}