How to hide a choice value on a reference field on a form

Jamie Sherry
Tera Contributor

I'm working on a form on the Incident table and I need to hide a value from the a dropdown field. I have a reference field on the form from the CI table called Operational Status. Operational Status is an integer field with choices, one of which is "retired". When selecting an option in the Operational Status field on the Incident form, I need to remove the option to select "retired".  How would I go about this?

1 ACCEPTED SOLUTION

yuvarajkate
Giga Guru

You can use Client Script for this.

Script:

function onLoad() {
    var operationalStatusField = g_form.getField('operational_status'); 
    if (operationalStatusField) {
        var options = g_form.getOptions('operational_status');
        for (var i = 0; i < options.length; i++) {
            if (options[i].text.toLowerCase() == 'retired') {
                g_form.removeOption('operational_status', options[i].value);
            }
        }
    }
}

 

Pease mark this as helpful or correct if this helped you in your problem.

View solution in original post

7 REPLIES 7

Initially I didn't have the dependent field Install Status from the CI also on the incident form, but once I added that the Configure Choices seems to work - right-click the Operational status field label.  You can remove Retired for each Install Status where it appears, and this is only in effect on the Incident form.

Juhi Poddar
Kilo Patron

Hello @Jamie Sherry 

Here are the steps to hide one of the option from choices:

right click on field label -> select configure dictionary -> Under related list choice section make the retired as inactive true.

Attaching the screenshot for better understanding:

JuhiPoddar_0-1734517864190.png

This will hide the choice retired from the dropdown.

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"

 

Thank You
Juhi Poddar

 

yuvarajkate
Giga Guru

You can use Client Script for this.

Script:

function onLoad() {
    var operationalStatusField = g_form.getField('operational_status'); 
    if (operationalStatusField) {
        var options = g_form.getOptions('operational_status');
        for (var i = 0; i < options.length; i++) {
            if (options[i].text.toLowerCase() == 'retired') {
                g_form.removeOption('operational_status', options[i].value);
            }
        }
    }
}

 

Pease mark this as helpful or correct if this helped you in your problem.