Make some empty field disappear

I would like to know it is possible when a field is empty to make it disappear using javascript. As shown in picture.

Thanks

  • Greetings!

    You need to go into the screen, find the fields that you want, and place the following on the "Create Script" of each field respectively to hide it on the "Cases Summary" screen.

    // for Product Field
    var productVal = CRM.GetContextInfo("cases","case_product");if(!productVal && Values("Act")=='281'){hidden=true;}else{hidden=false;}
    
    // for Product Description Field
    var productDesVal = CRM.GetContextInfo("cases","case_productDescription");if(!productDesVal && Values("Act")=='281'){hidden=true;}else{hidden=false;}

    I've used some assumptions in the above code - specifically the actual column name of each field. You'll need to change those to what they actually are in your Sage CRM system, and it should show/hide the field accordingly only when viewing the Cases Summary screen (system act of 281). This will hide the values on only the Summary screens, which is likely not the desired outcome.

    If you remove the " && Values("Act")=='281' " from the statement, it will hide the field regardless of what's done if a value is not present for that field. In that instance, the only way to change the value of the field for that Case will be the use of a Workflow Rule.

    I hope that helps.

    Best Regards,
    Basil

  • You can use the client side API to allow this.

    crm.ready(function()
    {
    var fieldlist = crm.fields();
    var i;
    for (i = 0; i < fieldlist.length; i++) {
    if (!fieldlist[i].value()&&fieldlist[0].mode=='view')
    {
    fieldlist[i].collapse()
    }
    }
    })