Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

GlideForm field types (scripted, UIB)

Fernnn
Tera Contributor
Hi, I'm trying to provide generated form data to a UIB form component. I have input fields working (e.g. {"maxLength": 40, "type": "string", "internalType": "string"}).
What I want: a non-input field type such as a formatter or catalog "label". I found what I believe to be internal GlideUIElement types below, which should help. I'm having trouble getting to the finish line.
 
          , El = "annotation"
          , zl = "auto_increment"
          , Tl = "auto_number"
          , Bl = "boolean"
          , Sl = "char"
          , Gl = "choice"
          , Cl = "composite_field"
          , Al = "conditions"
          , Nl = "css"
          , Ol = "currency"
          , Dl = "currency2"
          , Il = "glide_date"
          , Pl = "glide_date_time"
          , Ll = "datetime"
          , Vl = "days_of_week"
          , Ml = "decimal"
          , Fl = "documentation_field"
          , Ul = "document_id"
          , jl = "domain_id"
          , Hl = "domain_path"
          , $l = "due_date"
          , Wl = "glide_duration"
          , ql = "email"
          , Yl = "glide_encrypted"
          , Kl = "field_list"
          , Ql = "field_lookup"
          , Xl = "field_name"
          , Jl = "file_attachment"
          , Zl = "float"
          , oa = "glide_list"
          , ea = "GUID"
          , ra = "html"
          , na = "input_group"
          , la = "integer"
          , aa = "int"
          , ta = "long"
          , ia = "longint"
          , sa = "integer_date"
          , ca = "integer_time"
          , da = "ip_addr"
          , fa = "ip_address"
          , ma = "journal_input"
          , wa = "json"
          , pa = "multi_two_lines"
          , ga = "multi_small"
          , ba = "simple_name_values"
          , va = "date"
          , ua = "password"
          , ha = "password2"
          , ya = "percent_complete"
          , _a = "ph_number"
          , ka = "phone_number"
          , xa = "phone_number_e164"
          , Ra = "price"
          , Ea = "radio"
          , za = "reference"
          , Ta = "script"
          , Ba = "script_plain"
          , Sa = "short_table_name"
          , Ga = "slushbucket"
          , Ca = "string"
          , Aa = "string_full_utf8"
          , Na = "str_long"
          , Oa = "str_short"
          , Da = "table_name"
          , Ia = "template_value"
          , Pa = "textarea"
          , La = "glide_time"
          , Va = "timer"
          , Ma = "translated_field"
          , Fa = "translated_html"
          , Ua = "translated_text"
          , ja = "url"
          , Ha = "user_image"
          , $a = "glide_utc_time"
          , Wa = "version"
          , qa = "wide_text"
          , Ya = "wiki_text"
          , Ka = "workflow"
          , Qa = "user_roles"
          , Xa = "xml"
          , Ja = "condition_string"
          , Za = "order_index"
          , ot = "html_script"
          , et = "user_input"
          , rt = "related_tags"
          , nt = "email_script";
 
 
uib, ui builder, g_form, GlideForm, GlideUIElement, scripting, UI, workspace
8 REPLIES 8

Fernnn
Tera Contributor

A more complete field example:

firstName: {} 19 keys

name: 
"firstName"
label: 
"firstName"
visible: true
readonly: false
mandatory: false
isEncrypted: false
encryptionContext: 
""
sys_readonly: false
canWrite: true
canRead: true
canCreate: true
fieldHint: null
isGlideVar: false
value: 
"SUSIE"
displayValue: 
"SUSIE"
originalValue: 
"SUSIE"
maxLength: 40
type: 
"string"
internalType: 
"string"

AhsanM
Tera Expert

Interesting challenge. Based on what you are sharing, it looks like you are trying to map a non-input display element using the same field schema structure that UIB uses for input fields.

For a label or annotation type display element, try using the "annotation" type from the internal types you listed. Here is an example structure you can pass:

 
{
    name: "myLabel",
    label: "This is a label",
    visible: true,
    readonly: true,
    mandatory: false,
    canWrite: false,
    canRead: true,
    canCreate: false,
    value: "Your label text here",
    displayValue: "Your label text here",
    type: "string",
    internalType: "annotation"
}

The key here is setting internalType to "annotation" while keeping type as "string". The annotation internalType tells the UIB renderer to treat this as a display only element rather than an input field.

If annotation does not render as expected, also try "translated_text" or "translated_html" as the internalType, as these are designed for display only content in the GlideUIElement world.

 

A couple of questions that might help narrow it down further:

  • Are you building this inside a UIB custom component or using the out of the box form component?
  • Are you passing this schema dynamically via a data resource or hardcoding it in the component properties?

That context would help pinpoint exactly where the rendering is falling short.

Ahsan
ServiceNow Developer & Admin
Builder of NowFixer | Free AI debugging tool for ServiceNow scripts

Fernnn
Tera Contributor

Thanks for the response! When I try a new type I always changed type and internalType at the same time. This time I did as you suggested, but it displayed like a read-only string field rather than an annotation. When I change both, it displays an empty annotation, implying that I may be missing a property.

I'm wrapping the baseline form component
Dynamically.

Also, speaking from experience, LLMs really don't know what they're doing when it comes to highly technical or niche ServiceNow concepts. Your own guesses are likely to be more helpful here.

AhsanM
Tera Expert

Thanks for the feedback, that is fair and appreciated. You are right that this is genuinely niche territory. That said, the fact that changing both type and internalType to annotation gives you an empty annotation is actually useful information. It suggests the renderer recognises the type but is not finding the value it needs to display.

 

A few things worth trying based on that observation:

The annotation type in ServiceNow typically expects the display content in a specific property. Try adding a "text" property alongside value and displayValue:

 
{
    name: "myAnnotation",
    label: "My Label",
    visible: true,
    readonly: true,
    mandatory: false,
    canWrite: false,
    canRead: true,
    canCreate: false,
    value: "Your annotation text here",
    displayValue: "Your annotation text here",
    text: "Your annotation text here",
    type: "annotation",
    internalType: "annotation"
}

Also worth checking whether the baseline form component you are wrapping expects a "fieldType" or "uiType" property in addition to type and internalType. Some UIB components have their own property layer on top of the GlideUIElement schema.

 

If none of these work, the most reliable path might be inspecting the network payload of a native form that already renders an annotation field and comparing the exact property structure it receives. That would give you the ground truth rather than guesswork.

Ahsan
ServiceNow Developer & Admin
Builder of NowFixer | Free AI debugging tool for ServiceNow scripts