Cilent scipt

nameisnani
Mega Sage

Hi Team ,

 

Catalog Build 

 

When ever user selects [ Request Category >> Production access ] , Then short desp and Descp field should be not visible .

 

NOTE :- Short descp and descp fields coming from the variable set .

 

Can anyone please help me here , 

 

nameisnani_0-1709714448384.png

 

Thanks in advance 

 

1 ACCEPTED SOLUTION

shyamkumar VK
Kilo Patron

@nameisnani , You can Write on Change Client Script on Request Category and use below script 

 

var access = g_form.getValue('request_category) // replace with correct variable name 
if(acess=='production access'){
g_form.setMandatory('variablename', false);
g_form.setVisible('variablename', false);
}

 

 
UI Policy based on Condition like Request Category is Production Access , Create UI Policy Actions for both Short Description - Make Visible to True and Mandatory to False on both Variables 
 
Short Description - Visible False - Mandatory False 
Description - Visible False - Mandatory False 
 
Regards,
Shyamkumar
 
Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

View solution in original post

18 REPLIES 18

Community Alums
Not applicable

UI Policies are alternatives to client scripts and can dynamically change information on a form. They offer a more straightforward approach to hiding and displaying fields based on certain conditions.

Here's how you can set this up:

  1. Navigate to "System UI > UI Policies."
  2. Click "New" to create a new UI Policy.
  3. Fill in the necessary fields:
    • Name: Enter a descriptive name.
    • Table: Select the table where your catalog item resides.
    • Order: Enter a number to determine the order in which the UI Policy is applied relative to other UI Policies.
    • Short description: Provide a brief description.
    • Conditions: Set this to Request Category is Production access.
  4. Submit the form.
  5. In the UI Policy Actions related list, click on "New."
  6. Set the following fields:
    • Field name: Select "Short Description."
    • Visible: Select "False."
    • Submit the form.
  7. Repeat step 5 and 6 for the "Description" field.

This UI Policy will hide the "Short Description" and "Description" fields when the "Request Category" is set to "Production access."

Remember, as always, to thoroughly test any changes in a non-production environment first. Also, the exact navigation and steps may vary slightly depending on your specific ServiceNow version.

chat GPT !


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi @Community Alums  ,,, his reply from chat gpt 😂

😀😀