Looking to customize 'Contextual Search'

Community Alums
Not applicable

Hello,

There is a "Related Search Results" in our Incident form, when user clicks the 'Attach' button, the knowledge article is added to the Additional Comments field.

Like that, we need the 'Attach' button also to populate the Knowledge Article number in the 'KB Article' (custom reference field) on the form.

Or, create another button next to 'Attach' button to populate the KB # in the "KB Article" reference field on the form.

Need help to customize this module.

Thanks,

Rajini

5 REPLIES 5

melosborne
Mega Expert

Hello Rajini,



To clarify, is this attach button one that was customized and added for your particular Incident form?



Thank you,


-Mel


Community Alums
Not applicable

Look at the screenshot.



find_real_file.png


The attach functionality is in cxs_Knowledge script include. But you cannot edit it. If you would like to add additional functionality to it you have to extend this script include and update getArticleInfo function


lakshminarayan4
ServiceNow Employee
ServiceNow Employee

The "attach" button comes from a macro. if you want additional widgets beside those button , you need to customize the "cxs_result_table" which is a part of contextual search plugin.   Currently the code looks   like this.



Screen Shot 2016-12-22 at 9.47.40 AM.png



        All you have to do is add one more button tag in <td> element. After adding a button , the code will look like this.



Screen Shot 2016-12-22 at 9.51.07 AM.png


                                 



After adding a button you can   listen for click events from any client script   and populate the custom reference fields by using g_form methods.



Please remember to delete this macro before upgrading your instance. so that you will always get the latest update from Servicenow.




Thanks