How to hide incident form fields using Business rule.

Vijay Kumar4
Mega Guru

I have created 4 Encrypted text field in the incident form. And also created two record producer. 

I want to map 3 fields in record producer to incident form's 3 encrypted field. That time , i want to hide rest 1 field.

I have done it through ui policy. By giving condition like this. if short_description is "info checking". 

find_real_file.png

I created ui policy action for this condition , if it is yes visibility is false. same for both record producer. I mean i used short description of record producer to hide fields. Is it is a good practice.

Please help me

1 ACCEPTED SOLUTION

Martin Ivanov
Giga Sage
Giga Sage

UI Policies and Client scripts are your stuff. If you can do it with UI policy, it is preferred rather than Client script.

Business rules are server-side and you cannot hide fields on the form with them. You can use a display business rule to ask the database if your condition is fulfilled and store the answer in the g_scratchapd object, but again, you will need a client script to hide the fields based on the results, so it doesn't make sense.

Please Mark Correct AND Helpful. Thanks!


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

You can use BR which will be calling UI Script. In this UI Script you can point what you need to do while passing to it's methods either the entire current object or only what you need from it (I would use this approach as the whole current object is big , hence performance issues might occur). Also you can use client script to call this UI Script :

ScriptLoader.getScripts(['sn_grc.IndicatorScheduling.jsdbx'], function() {
sn_grc.IndicatorScheduling.setNextRunTime();
});

 

Or as direct init of the UIScript via BR :

var uiScript = new IndicatorScheduling().setNextRunTime() 

Martin Ivanov
Giga Sage
Giga Sage

UI Policies and Client scripts are your stuff. If you can do it with UI policy, it is preferred rather than Client script.

Business rules are server-side and you cannot hide fields on the form with them. You can use a display business rule to ask the database if your condition is fulfilled and store the answer in the g_scratchapd object, but again, you will need a client script to hide the fields based on the results, so it doesn't make sense.

Please Mark Correct AND Helpful. Thanks!


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024