Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Info message after clicking on related search results

Dhanashree1
Tera Expert

when I click on the Related Search Results arrow on the form, I want a info message to be displayed. Any suggestions on how to configure it?

 

Dhanashree1_0-1718979157887.png

 

4 REPLIES 4

Yashsvi
Kilo Sage

Hi @Dhanashree1,

please check try this script:

function onLoad() {
    var relatedSearchButton = document.querySelector('#related_search_button_id'); // Adjust the selector
    
    if (relatedSearchButton) {
        relatedSearchButton.addEventListener('click', function() {
            g_form.addInfoMessage('This is your info message.');
        });
    }
}

Thank you, please make helpful if you accept the solution. 

Can you also suggest how can I find the related search button id?

Hi @Dhanashree1,

please try this script:

function onLoad() {
    var relatedSearchButton = document.querySelector('#related_search_button_id'); // Use the correct ID
    
    if (relatedSearchButton) {
        relatedSearchButton.addEventListener('click', function() {
            g_form.addInfoMessage('This is your info message.');
        });
    }
}

Thank you, please make helpful if you accept the solution. 

Tried this but not working.