How to choose which fields of table will be shown

Alon Grod
Tera Expert

 

I have the Reference field u_jira_project on the incident table which is a reference field to u_jira_project table. When I click on the field u_jira_project to choose from the list of u_jira_project table, It shows me the column sys_id but I want to see instead the columns u_jira_name and u_jira_key of u_jira_project table. And after the user chose a project, i want the u_jira_name value will be shown inside u_jira_project on the incident table.
How can I achieve that? 

1 ACCEPTED SOLUTION

Rahul Kumar17
Tera Guru

Hi,

 

To display the "u_jira_name" and "u_jira_key" columns instead of the "sys_id" column in the reference field dropdown for the "u_jira_project" field on the incident table, you need to modify the reference field properties for that field.

Here are the steps to achieve this:

  1. Navigate to the "Incident" table in ServiceNow.

  2. Click on the gear icon and select "Configure" > "Form Layout".

  3. Find the "u_jira_project" field on the form and click the gear icon to open the reference field properties.

  4. In the reference field properties, go to the "Advanced" tab and click the "Add" button to add a new property.

  5. Set the name of the property to "reference_qual" and set the value to the following script:

    active=true^u_jira_nameISNOTEMPTY

    This script will filter the list of u_jira_project records to show only the ones that are active and have a value in the "u_jira_name" field.

  6. Add another property named "reference_columns" with the value "u_jira_name,u_jira_key".

  7. Save the reference field properties and the form layout.

  8. Test the changes by clicking on the "u_jira_project" field on an incident record. You should now see the "u_jira_name" and "u_jira_key" columns in the dropdown list.

To display the "u_jira_name" value inside the "u_jira_project" field on the incident table after the user chooses a project, you can use a UI policy with a script that sets the value of the "u_jira_name" field to the selected project's "u_jira_name" value.

Here are the steps to create the UI policy:

  1. Navigate to the "Incident" table in ServiceNow.

  2. Click on the gear icon and select "UI Policies".

  3. Click the "New" button to create a new UI policy.

  4. Give the UI policy a name and set the "Table" field to "Incident".

  5. Set the "Condition" field to "true" to apply the UI policy to all incidents.

  6. Under "UI Actions", click the "Add" button and select "Set Value".

  7. In the "Set Value" form, set the "Field" field to "u_jira_project.u_jira_name".

  8. Set the "Value" field to the script:

    current.u_jira_project.u_jira_name

    This script sets the "u_jira_name" field on the incident to the value of the "u_jira_name" field on the selected project.

  9. Save the UI policy.

Now, when a user selects a project in the "u_jira_project" field on an incident, the "u_jira_name" field on the incident will be automatically populated with the selected project's "u_jira_name" value.

 

Thanks,

Rahul Kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

View solution in original post

1 REPLY 1

Rahul Kumar17
Tera Guru

Hi,

 

To display the "u_jira_name" and "u_jira_key" columns instead of the "sys_id" column in the reference field dropdown for the "u_jira_project" field on the incident table, you need to modify the reference field properties for that field.

Here are the steps to achieve this:

  1. Navigate to the "Incident" table in ServiceNow.

  2. Click on the gear icon and select "Configure" > "Form Layout".

  3. Find the "u_jira_project" field on the form and click the gear icon to open the reference field properties.

  4. In the reference field properties, go to the "Advanced" tab and click the "Add" button to add a new property.

  5. Set the name of the property to "reference_qual" and set the value to the following script:

    active=true^u_jira_nameISNOTEMPTY

    This script will filter the list of u_jira_project records to show only the ones that are active and have a value in the "u_jira_name" field.

  6. Add another property named "reference_columns" with the value "u_jira_name,u_jira_key".

  7. Save the reference field properties and the form layout.

  8. Test the changes by clicking on the "u_jira_project" field on an incident record. You should now see the "u_jira_name" and "u_jira_key" columns in the dropdown list.

To display the "u_jira_name" value inside the "u_jira_project" field on the incident table after the user chooses a project, you can use a UI policy with a script that sets the value of the "u_jira_name" field to the selected project's "u_jira_name" value.

Here are the steps to create the UI policy:

  1. Navigate to the "Incident" table in ServiceNow.

  2. Click on the gear icon and select "UI Policies".

  3. Click the "New" button to create a new UI policy.

  4. Give the UI policy a name and set the "Table" field to "Incident".

  5. Set the "Condition" field to "true" to apply the UI policy to all incidents.

  6. Under "UI Actions", click the "Add" button and select "Set Value".

  7. In the "Set Value" form, set the "Field" field to "u_jira_project.u_jira_name".

  8. Set the "Value" field to the script:

    current.u_jira_project.u_jira_name

    This script sets the "u_jira_name" field on the incident to the value of the "u_jira_name" field on the selected project.

  9. Save the UI policy.

Now, when a user selects a project in the "u_jira_project" field on an incident, the "u_jira_name" field on the incident will be automatically populated with the selected project's "u_jira_name" value.

 

Thanks,

Rahul Kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar