checking value of a glide list field

kunal16
Tera Expert

I have a glide list field on the Server form called Tenants (u_tenants) - this is referring to a custom table called u_tenant.

If the value of this field is KI, i.e., if Tenants = KI, then hide the section CI details from the Server form.

How this can be achieved?? Any help will be appreciated.

Thanks in advance!!

1 ACCEPTED SOLUTION

kunal16
Tera Expert

It can done by writing an onLoad client script -


Script:



function onLoad() {


  //Hiding the section CI details for the Server form if Tenant is KPMG Global



  var grp = '0a47fe703702da00e4b58f9754990e43'; // Sys ID of Tenant KI


  var des = g_form.getValue('u_tenants');



  if(des.indexOf(grp)>=0)


  {


  g_form.setSectionDisplay('ci_details', false); // Hiding the section CI details from the form


  }


}


View solution in original post

4 REPLIES 4

arnabwa
Giga Guru

Hi Kunal,



Write an OnChange client script on the Tenant field. Somewhat like this :


var sections = g_form.getSections();


If(newValue = "KI") {



sections[1].style.display = 'none'; //here you have to give in the braces [ ] the sequence no.of the section you want to hide.



}


else {


sections[1].style.display = '';


}



Please let me know if it works for you.



Thanks,


Arnab


Hi Arnab,


Thanks for your reply.


Not sure but I guess this might work for on change of Tenant field but my requirement is to hide the section on load of the form based on the value on the field Tenant.


Also, even on change its not working...


Pratyush Mandal
Mega Expert

Hi Kunal


You can write onLoad client script -



var sections = g_form.getSections();


var test_Tenants = g_form.getValue('Tenants') ; // Field name


if(test_Tenants == 'KI'){



sections[1].style.display = 'none'; //here you have to give in the braces [ ] the sequence no.of the section you want to hide.



}


else {


sections[1].style.display = '';


}



Thanks,


Pratyush


kunal16
Tera Expert

It can done by writing an onLoad client script -


Script:



function onLoad() {


  //Hiding the section CI details for the Server form if Tenant is KPMG Global



  var grp = '0a47fe703702da00e4b58f9754990e43'; // Sys ID of Tenant KI


  var des = g_form.getValue('u_tenants');



  if(des.indexOf(grp)>=0)


  {


  g_form.setSectionDisplay('ci_details', false); // Hiding the section CI details from the form


  }


}