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.

Restricting Reference Field Choices

ndejoya
Tera Contributor

Hello! Just had a question I was hoping to get some guidance on as I am relatively new to the ServiceNow environment.

 

The Profit Center field references a Profit Center table

The Fund field references a different table that includes Profit Centers

Both fields are pre-populated

 

What I'm wondering is if there is a way to restrict the Fund field choices to only show Funds that are related to that specific Profit Center populated? Also, when the form is in a specific status, the Fund field should be cleared out and require that new selection. So I was also wondering how I would go about doing that as well. Thank you for your time! 

 

ref q.PNG

1 ACCEPTED SOLUTION

What exactly is meant by status field. Is it a field.
If Yes,

You can write a on change client script to clear the value.

Navigate to Client scripts:
Select new,

Table: Select the table

Type : On Change
Field name: SELECT THE STATUS FIELD

Write the below script



Hope this helps. Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.

View solution in original post

7 REPLIES 7

What exactly is meant by status field. Is it a field.
If Yes,

You can write a on change client script to clear the value.

Navigate to Client scripts:
Select new,

Table: Select the table

Type : On Change
Field name: SELECT THE STATUS FIELD

Write the below script



Hope this helps. Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.

Yes, it is a field. Thank you so much for your help! Was there a script that you added in your last message? 

Hi @ndejoya ,
It was the below on change client script

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }

   //Type appropriate comment here, and begin script below

   g_form.clearValue('FUND_BACKEND_VALUE')
   
}