Make type field read-only on UI Page opened via GlideModal (Audit Engagement / Activity)

ujjwalababa
Tera Contributor

Hi everyone,

I’m working on a UI Page opened in a Glide Modal and I need to make the type field read-only based on the calling table. When the UI Page is opened from

  • sn_audit_engagement

  • sn_audit_activity

The type dropdown should be pre-populated and read-only

For other tables, the field should remain editable

However, the field either:

  • Does not get disabled consistently, or

  • Gets disabled before the options are loaded

client script logic:

 
var modal = GlideModal.get(); var callerTable = modal.getPreference('caller_table'); var typeFromModal = modal.getPreference('sysparm_type'); var typeDropdown = document.getElementById('type'); if (callerTable === 'sn_audit_activity' || callerTable === 'sn_audit_engagement') { typeDropdown.value = typeFromModal; typeDropdown.disabled = true; }

What is the recommended to reliably make a dropdown field read-only in a UI Page, especially when the UI Page loads asynchronously inside a GlideModal?

Any guidance or examples would be really helpful.

Thanks in advance!

ujjwalababa_0-1770732438909.png

 

0 REPLIES 0