How to hide a value in a list fields using Business Rule

ursnani
Giga Guru

Can anyone please suggest me how to hide a value using business rule.

To be specific When ever the state is other draft and after inserting the problem the draft value in the state field should not be visible.

can anyone please help me on this .

Thanks

1 ACCEPTED SOLUTION

amlanpal
Kilo Sage

Hi Naveen,



For this you need to write an onLoad Client Script. I have checked in my instance against another state and it is working fine. Request you to check the below script and let me know. Find the below screenshot.


If your requirement is to hide the State 'Draft' for any specific view you can mentioned in the 'View' under which the Client Script will run.


find_real_file.png



I hope this helps.Please mark correct/helpful based on impact


View solution in original post

8 REPLIES 8

snehabinani26
Tera Guru

Hi Naveen,



Below is the code to restrict the choice values from selection of user. You can edit the condition as and when required. One of my requirement was to restrict user from selecting specific contact type option from Dropdown during On-load Client Script. These choice action will still be visible but not select able.



function onLoad() {


    //Type appropriate comment here, and begin script below


    disableOption();


}



//this function will disable the Source options to be selectable. But this will be visible as dropdown option.


function disableOption()


{


    var fieldName = 'contact_type';


      var control = g_form.getControl('contact_type');


      if (control && !control.options)


          {


                      var name = 'sys_select.' + this.incident + '.' + fieldName;


                      control = gel(name);


             


          }


          if (!control)


          return;



          if (!control.options)


          return;




          var options = control.options;



        for (var i = 1; i < options.length; i++)


        {


         


              var option = options[i];


  //Disabling email, self-service and chat


                if((options[i].value == "email" || options[i].value == 'self-service' || options[i].value == 'chat'))


          {


              control.options[i].disabled = 'true';


            }


     


          }




}



Hope this helps.



Regards,


Sneha Binani


ursnani
Giga Guru

I tried using the onload client script it worked perfectly, but then i have an issue with it like.



We have Open view under the problem. when we click that view all the open problem are populated in list view. from that view if we want to create a new Problem then it is not populating the Draft value.



If we want to create new value then draft value must be visible, but it is not visible from the Open view. I dont know y.


amlanpal
Kilo Sage

Hi Naveen,



For this you need to write an onLoad Client Script. I have checked in my instance against another state and it is working fine. Request you to check the below script and let me know. Find the below screenshot.


If your requirement is to hide the State 'Draft' for any specific view you can mentioned in the 'View' under which the Client Script will run.


find_real_file.png



I hope this helps.Please mark correct/helpful based on impact


Thanks Amian Pal.


It worked perfectly.