Remove Gap between Fields.

Hemanth Naik
Tera Guru

Hello everyone, I have a requirement 

I have a field "category" when form loads initially its value is "none" .so I am trying this scenario when category value changes to other ". I want to hide Description and short description fields. I have written a client script to hide them and remove the gap between the fields but as the fields are in different sections the gap is not clearing. Can any one please help How to remove gap between them.

code:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading ) {
        return;
    }
    if (newValue == 'Other') {
        g_form.setDisplay('description', false);
        g_form.setDisplay('short_description', false);

    }
    else{
        g_form.setDisplay('description', true);
        g_form.setDisplay('short_description', true);
    }
}
1 ACCEPTED SOLUTION

Hi @Hemanth Naik 

 

UI policy i mentioned to avoid client script. There is no way to overcome this space, as we are hiding attribute not removing so it will be still there.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Hemanth Naik 

 

You can use UI policy for this , also it will not overcome the empty spaces. It is by design.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hemanth Naik
Tera Guru

Hi @Dr Atul G- LNG ,

Checked with Ui Policies also but not able to clear the space. As you it is OOB, can't we achieve this by any chance?

Hi @Hemanth Naik 

 

UI policy i mentioned to avoid client script. There is no way to overcome this space, as we are hiding attribute not removing so it will be still there.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Anubhav24
Mega Sage
Mega Sage

Hi @Hemanth Naik ,

Ideally setDisplay removes the gap , any chance some other logic is also implemented on the same field and it might be conflicting with the script, also check the UI type of the script.

 

I tried your script in my PDI and it is working totally fine.

 

Please mark my response correct/helpful if it helped you.