Hide the Choice on the reference field which should view for old records not for new records

NITHIN KUMAR1
Tera Contributor

On a demand form in servicenow,

  1. The 'XXXXX' option is available for selection in the 'Source' dropdown list.

  2. The 'YYYY' option is no longer visible or selectable in the 'Source' dropdown list.

  3. Existing records previously using 'YYYY' remain unchanged, but new records cannot use this option.

    Source is on the form which is reference field pointing towards choice list table.

    Could anyone please help me these?

 

 

2 REPLIES 2

lpruit2
Kilo Sage

Greetings @NITHIN KUMAR1. Is the Source field an out-of-the-box field or is this a custom field? When I signed into my Personal Developer Instance (PDI) I did NOT see an existing field called "Source" on the Demand table. In my example, I am using the out-of-the-box "Portfolio" field. 

 

However, if you are referencing another table, you can utilize a Reference qualifier on the Dictionary entry for the "Source" field. If you are not familiar with navigating to the Dictionary entry to a field, you can right-click the field and select "Configure Dictionary". 

 

lpruit2_0-1767188705246.png

Then, once you are in the Dictionary entry for the "Source" field, you can navigate to the "Reference Specification" tab which allows you to pick which table you want to reference. Below the Reference field [table selection], there is the "Use Reference Qualifier" drop-down. You could select "Simple" and use the Condition Builder to filter out the unwanted selections. 

 

lpruit2_1-1767188854027.png

 

If you are NOT using a Reference field and have a String field that has a selection of Choices, you could use an onLoad Client Script that hides the choice you no longer wish to display. This would NOT impact the existing records with that particular choice(s) and would HIDE that choice for future selection. I'll include a link to the Client Script that shows examples of the GlideForm .removeOption method below. 

 

GlideForm (g_form) | ServiceNow Developers

 

lpruit2_2-1767189350867.png

 

Sangamesh_p
Tera Contributor

Expected Behavior

Users should be able to see and select YYYY in the Source field dropdown.

Root Cause

The YYYY choice record (used by the Source field) was still present, but it was no longer eligible to appear in the lookup list. This typically happens for one of the following reasons:

✔ Most Common Causes

  1. The YYYY record was set to Active = false
    Since the lookup filters out inactive records, the value disappears from the dropdown, but continues to display on historical records.

  2. A Reference Qualifier or condition excluded the value
    Example: the field has a qualifier like

     
    active = true

    or a script that prevents YYYY from being returned.

  3. A Client Script or UI Policy removed the option
    Often this is done using code such as:

     
    g_form.removeOption('source', 'YYYY');

Because the record still exists, existing data remains intact, but new records cannot select the value — which matches the observed behavior.