Adding a default value in sn-record picker

Apurv Kumar
Tera Expert

I have an sn record picker in which i am referencing the "core_country" table. I want to populate a default value whenever i open the widget. The default value of the country should be "India".

Could someone please help me in this.

 

Thank you

 

3 REPLIES 3

Sagar Pagar
Tera Patron

Hi @Apurv Kumar,

Take a look at old thread. It will help you to set the default value for sn-record picker.

How can I Set Value to snRecordPicker if the rowCount is 1 

How do I set a default value for snRecordPicker directive? 

Reference Fields with the snRecordPicker Directive 

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Riya Verma
Kilo Sage
Kilo Sage

Hi @Apurv Kumar ,

 

Hope you are doing great.

 

  1. Locate the SN record picker widget in your ServiceNow instance.
  2. Access the widget configuration settings.
  3. Find the property that allows you to specify a default value for the record picker.
  4. Set the default value property to "India" or the corresponding value that represents India in the "core_country" table. Ensure that the default value matches the appropriate field in the "core_country" table (e.g., the sys_id or another unique identifier for India).
  5. Save the widget configuration settings.
 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma


@Riya Verma wrote:

Hi @Apurv Kumar ,

 

Hope you are doing great.

 

  1. Locate the SN record picker widget in your ServiceNow instance.
  2. Access the widget configuration settings.
  3. Find the property that allows you to specify a default value for the record picker.
  4. Set the default value property to "India" or the how to drag click without tape corresponding value that represents India in the "core_country" table. Ensure that the default value matches the appropriate field in the "core_country" table (e.g., the sys_id or another unique identifier for India).
  5. Save the widget configuration settings.
 

In ServiceNow, the sn-record-picker is a UI component used for selecting records from a specific table. To add a default value to the sn-record-picker component, you can follow these steps:

  1. Locate the sn-record-picker Widget: In your ServiceNow instance, find the location where the sn-record-picker widget is being used. This could be within a form or a custom UI page.

  2. Open the Form Designer: Open the Form Designer for the respective form or UI page where the sn-record-picker widget is placed. This allows you to modify the properties of the widget.

  3. Edit the sn-record-picker Widget Properties: Within the Form Designer, locate the sn-record-picker widget, and access its properties.

  4. Find the Default Value Property: Look for a property or attribute named "default value" or something similar. This property allows you to set the default value for the sn-record-picker.

  5. Set the Default Value: Enter the desired default value in the property field. The value should be a sys_id or a unique identifier of the record you want to set as the default value.

  6. Save and Publish: Save your changes in the Form Designer and publish the form or UI page.

By following these steps, you should be able to set a default value for the sn-record-picker component in ServiceNow. The specified default value will be pre-selected in the picker when the form or UI page is loaded.