I'm facing issue in my dynamic content block, I am trying to create a search string and on click of button it should filter records in the dashboard.

Garima Tripath1
Tera Contributor

This is the script I wrote:

The button part is not working, can someone please take a look.

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
     var my_dashboardMessageHandler = new DashboardMessageHandler("cased_unique_id");
    
    function searchForDesc(str) {
        var filter_message = {};
        filter_message.id = "cased_unique_id";
        filter_message.table="x_mcim_it_service_case2";
    
    filter_message.filter="descriptionLIKE" +str;
     SNC.canvas.interactiveFilters.setDefaultValue({
                id: filter_message.id,
                filters: [filter_message]
            }, false);
        my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
    }
    </script>
    <input id="myCustomSearchString" type="text" value="" placeholder="Search.." size="40"  align="center"/>
     <script>
         function val(){
            var inputVal = document.getElementById("myCustomSearchString").value;
         console.log("garima"+ inputVal);
             searchForDesc(inputVal);
         }
    </script>
    <button onClick="val();">Apply</button>
    
    
</j:jelly>

3 REPLIES 3

Garima Tripath1
Tera Contributor

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
     var my_dashboardMessageHandler = new DashboardMessageHandler("cased_unique_id");
    
    function searchForDesc(str) {
        var filter_message = {};
        filter_message.id = "cased_unique_id";
        filter_message.table="x_mcim_it_service_case2";
    
    filter_message.filter="descriptionLIKE" +str;
     SNC.canvas.interactiveFilters.setDefaultValue({
                id: filter_message.id,
                filters: [filter_message]
            }, false);
        my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
    }
    </script>
    <input id="myCustomSearchString" type="text" value="" placeholder="Search.." size="40"  align="center"/>
     <script>
         function val(){
            var inputVal = document.getElementById("myCustomSearchString").value;
         console.log("garima"+ inputVal);
             searchForDesc(inputVal);
         }
    </script>
    <button onClick="val();">Apply</button>
    
    
</j:jelly>

Maik Skoddow
Tera Patron
Tera Patron

Thanks but this does not match my requirement, I want to create an apply button below the short description field text and on clicking on that apply button the filter should work, that is the part which is not working.

Could you please check my code and see where I'm going wrong, specifically this part.

 </script>
    <input id="myCustomSearchString" type="text" value="" placeholder="Search.." size="40"  align="center"/>
     <script>
         function val(){
            var inputVal = document.getElementById("myCustomSearchString").value;
         console.log("garima"+ inputVal);
             searchForDesc(inputVal);
         }
    </script>
    <button onClick="val();">Apply</button>