contextual search how can I configure this button?

andy_dufresne
Tera Expert

Hello,

I have a contextual search, when a user searches it gives a list of "record producers".   The user wants to simple click on the link and it should take him to the required 'record producer'.

So I want to get rid of this button "Take Me To Form" [which does the right job, but want the url link before it to do the job]

find_real_file.png

I have searched everywhere in the contextual search and record producers, but cannot locate this "Take Me To Form" button.

1 ACCEPTED SOLUTION

Hi Andy.



You can get rid of the button with a catalog client script. Please be aware though, when you upgrade, there may be changes to Contextual Search could break your script. You'll be able to see if we've changed anything in contextual search in the release notes though.



This is the script:


function onLoad() {


      document.observe("cxs:target_update", function() {


              $$("#cxs_results_container button.request_catalog_button_with_icon").each(function(elem, index) {


                      elem.hide();


              });


      });


}



The event cxs:target_update is fired each time a search is completed.



This is what my catalog client script looks like:


find_real_file.png



This will only work on your record producer. If you wanted to do hide the Order button when displaying contextual search results on a form you would need to create an onLoad client script there too. The however should be the same.



Let me know if this works for you.



Thanks,



Cameron


View solution in original post

16 REPLIES 16

cameronrichard
ServiceNow Employee
ServiceNow Employee

Hi Andy,



Contextual Search doesn't ship with a "Take Me To Form" button.



This looks like a record producer you're on. Can you check and make sure you have a variable in the Record Producer called "Contextual Search Results"?



Secondly, can you check if you have any Catalog Client Scripts that could be changing the button's name through the DOM?



Thanks,



Cameron


andy_dufresne
Tera Expert

Hi Cameron,



Thanks for your reply.



There is no variable with the name "Contextual Search Results". Should there be one?


There is no such client script either.



find_real_file.png


On looking further into sys_ui_messages.list, I notice following, but I stil dont know how I can get rid of this and use a simple link from the contextual search:



find_real_file.png



So do we know how/where this sys_ui_message gets called in the contextual search?



Thanks for the help!


If you can't find the variable then I don't think you're using Contextual Search. That variable is what we use to render all the search results that contextual search returns. If it isn't there then you probably aren't using it on that record producer.