Create Simple Element Code

Depending on the type of the simple element is the metadata to load.

//Char example
&WWPFormElementParentTitle = "Main Information"
Do 'GetParentIdFromTitle'
&WWPFormElement = New()
&WWPFormElement.WWPFormElementId = &WWPFormElementId
&WWPFormElement.WWPFormElementTitle = "First Name"
&WWPFormElement.WWPFormElementType = WorkWithPlus.DynamicForms.WWP_DF_ElementType.Simple
&WWPFormElement.WWPFormElementCaption = WorkWithPlus.DynamicForms.WWP_DF_ElementCaptionType.Label
&WWPFormElement.WWPFormElementDataType = WorkWithPlus.DynamicForms.WWP_DF_DataType.Character

&WWP_DF_CharMetadata = New()
&WWP_DF_CharMetadata.ControlType = WorkWithPlus.DynamicForms.WWP_DF_CharControlType.Text
&WWP_DF_CharMetadata.Length = 200
&WWP_DF_CharMetadata.IsRequired = True

&WWPFormElement.WWPFormElementMetadata = &WWP_DF_CharMetadata.ToJson()

&WWPFormElement.WWPFormElementParentId = &WWPFormElementParentId
&WWPForm.Element.Add(&WWPFormElement)
&WWPFormElementId += 1

 

Sub 'GetParentIdFromTitle'

    For &WWPFormElement In &WWPForm.Element
        If &WWPFormElement.WWPFormElementTitle = &WWPFormElementParentTitle
            &WWPFormElementParentId = &WWPFormElement.WWPFormElementParentId
            Exit
        EndIf
    EndFor

EndSub

Char

DynamicFormMetadataChar

 

Boolean

DynamicFormMetadataBoolean

Date

DynamicFormMetadataDate

Image

DynamicFormMetadataImage

Numeric

DynamicFormMetadataNumeric