Catalog Item field visibility

Prashanth Ranga
Tera Contributor

Hi , 

 

I have a field Planned Hours in RITM table . I need to show this field only if catalog is Estimates .

If i open any RITM of estimates then only field should be displayed and for others catalog items field should not be displayed and also field should be mandatory . any suggestions on code wise . 

 

Thanks in advance . 

1 ACCEPTED SOLUTION

Krushna R Birla
Kilo Sage

Hi @Prashanth Ranga 

 

You need to create UI Policy for this on sc_req_item table and in condition as item is <your_catalog item> and in ui policy action you need to set visibility for that field as false

 

This will definitely helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.

 

If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.

 

Best Regards,
Krushna Birla

View solution in original post

4 REPLIES 4

Krushna R Birla
Kilo Sage

Hi @Prashanth Ranga 

 

You need to create UI Policy for this on sc_req_item table and in condition as item is <your_catalog item> and in ui policy action you need to set visibility for that field as false

 

This will definitely helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.

 

If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.

 

Best Regards,
Krushna Birla

Deborah Brown L
Kilo Sage

@Prashanth Ranga ,

 

Write a onload client script for RITM table and add the condition in the script.

function onLoad() {
   //Type appropriate comment here, and begin script below
   if(g_form.getValue('cat_item') == 'catalog item sys id'){
    g_form.setDisplay('planned_hours',true);
g_form.setMandatory('planned_hours',true);
   }
else{
g_form.setMandatory('planned_hours',true);
g_form.setDisplay('planned_hours',true);
}
}
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me.

Regards,
Deborah Brown

Hi @Prashanth Ranga @Deborah Brown L 

 

You don't need to use client script for this to make fields read only, mandatory and set visibility. Instead, you can use UI Policy as per the best practices provided by servicenow.

 

If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.

 

Best Regards,
Krushna Birla

@Deborah Brown L Could you please mark above solution as the accepted solution that would be helpful. Thanks 🙂 

 

Best Regards,
Krushna Birla