Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Lookup Select Box Values Not Transferring to Backend Table in Record Producer

hema sundar
Tera Contributor

Hello Community,

We have a table named "x_g_jeg_cde_cde_request" which is in a custom scope. There is a Record Producer that contains two variables — "state_province" and "project_location_country" — both configured as Lookup Select Boxes on the form. These variables reference the table "x_g_jeg_cde_country_and_state", which contains both Country and State fields.

The "project_location_country" variable allows users to select a country, and the "state_province" variable is dependent on it, displaying the corresponding states (multiple selections allowed).

However, the issue is that the same fields (project_location_country and state_province) exist on the backend table as reference fields, but the values submitted through the Record Producer are not getting populated in the backend table.

Even when I tried changing the field types to Choice, I was unable to select "x_g_jeg_cde_country_and_state" as a reference table.

Could anyone suggest how to make this work properly with the Record Producer?

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@hema sundar 

the field type and variable type should map exactly.

I will suggest this

-> create a reference variable pointing to x_g_jeg_cde_country_and_state so that user selects country

-> create another string variable and auto populate the state based on above country

-> then on target table map the reference variable with reference field

-> on target table form dot walk this reference field and bring state on form

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

J Siva
Kilo Patron
Kilo Patron

Hi @hema sundar 
By default, a Lookup Select Box field stores the display value (such as the name) in the backend.
However, reference fields require the sys_id to establish the correct relationship.
To ensure this works properly in your record producer, configure the Lookup value field to return the sys_id. This way, the reference field in the target record can correctly link to the appropriate entry in your custom table.

JSiva_0-1761121894198.png

Regards,
Siva

 

ChallaR
Giga Guru

Hi @hema sundar , 

 

you can give try below solution -

1. Use a Script in the Record Producer to Map Variables to Fields

Record Producers do not automatically map variables to fields in the target table. You need to use a Script in the Record Producer to manually assign the values.

Here’s how you can do it

// Get values from variables
var selectedCountry = current.variables.project_location_country;
var selectedStates = current.variables.state_province; // Assuming it's a multi-select

// Set values on the target record
current.project_location_country = selectedCountry;

// For multi-select, you may need to handle it as a comma-separated string or use a related list
current.state_province = selectedStates;
``

If state_province is a multi-select, and your backend field is a reference, you may need to use a many-to-many relationship or a custom field type to store multiple values.

2. Ensure Variable Names Match Field Names (Optional)

If you want automatic mapping (without scripting), the variable names must exactly match the field names in the backend table. However, this only works for simple field types like string, not for reference or complex types.

 

Reference Table Not Showing in Choice Field

If you tried changing the field type to Choice and couldn’t select x_g_jeg_cde_country_and_state:

  • That’s expected — Choice fields don’t reference tables.
  • You should use a Reference field instead, and ensure the reference table is accessible in your scope.

If the table isn’t showing up, check:

  • Table permissions (is it accessible from your current scope?)
  • Application scope settings (you may need to allow cross-scope access)

Handling Multi-Select States

If users can select multiple states, consider:

  • Creating a many-to-many relationship table between x_g_jeg_cde_cde_request and x_g_jeg_cde_country_and_state
  • Or storing the selected states in a string field (comma-separated), if relational integrity isn’t critical

NOTE - 

  • Use Reference fields for relational data, not Choice fields.
  • Use scripts in Record Producers to map variables to fields.
  • For multi-selects, consider using List Collector instead of Lookup Select Box if you need better control.
  • Ensure cross-scope access is configured if you're referencing tables from another scope.

Please mark as complete and close the thread if this is helpful .

 

Thanks,

Rithika.ch