Modify the Order button on Contextual Search Results

Charlotte8
Tera Expert

Hello,

We've added a contextual search for catalogue items to a catalogue item (Miscellaneous Request) to try to help users search for a request that is more suitable before submitting the generic Misc request.

This is all working fine, however I was wondering how to add text to the order button which appears in the search results?

When using this function in the portal it simply displays as a button with no text: 

find_real_file.png

However if I do the same within the Service catalogue in ServiceNow UI it displays the word Order:

find_real_file.png

I've found that the contextual search function on record producers displays the button with the Order text however any catalogue items with a contextual search do not.

Thanks!

1 ACCEPTED SOLUTION

Charlotte8
Tera Expert

Logged with ServiceNow support who have confirmed a problem has been created for this which has been fixed in Tokyo.

Workaround is available in this KB article: KB1000915 - Search action button is visible without label on record producer results when show on ne...

View solution in original post

9 REPLIES 9

Can you clear your instance cache and try again reloading the portal page to see if this works or not.

Type in cache.do in Application Navigator search and hit enter:

find_real_file.png

Once done refresh your browser

I have tried this in my instance and seem this is the thing which is controlling the Order button to be displayed in Contextual Search result.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Unfortunately still nothing on the Misc request however I've checked a record producer which has the contextual search function on it and the text on the button displays on this!

So I wonder if the problem lies within the fact that I'm attempting to use this on a catalogue item instead of record producer?

Charlotte8
Tera Expert

Logged with ServiceNow support who have confirmed a problem has been created for this which has been fixed in Tokyo.

Workaround is available in this KB article: KB1000915 - Search action button is visible without label on record producer results when show on ne...

Ben Rowny
Tera Guru

I wish I'd found this thread earlier. This problem drove me crazy. Eventually SN Support linked me to the Problem record PRB1545548, and seeing the root cause I found another solution.

I wanted to keep the Widget and Angular ng-templates out-of-box, since ServiceNow is constantly making improvements to portal layout and accessibility and it's less diffing to do on an upgrade, so I looked for an upstream source.

Realizing that the Search Action Configurations are automatically created when you set up a Record Producer CXS Config, and they automatically set "Show on new record" to false, and that this field cannot be edited due to ACLs, but that the OOB "Create Incident" one has those all set to true, I looked at the code that creates the Search Action Configurations. I ended up modifying the Script Include "cxs_UIActionConfig" at instaneUrl/sys_script_include.do?sys_id=398646d587012300416e66d107cb0ba3 to change this (at like 26):

SHOW_ON_NEW_CONFIG: {
		"platform": ["order", "this_helped", "full_view"],
		"workspace": ["order", "flag", "full_view"],
		"rp": []
	},

to this:

SHOW_ON_NEW_CONFIG: {
		"platform": ["order", "this_helped", "full_view"],
		"workspace": ["order", "flag", "full_view"],
		// hack for SNC HI PRB1545548:
		"rp": ["order", "this_helped"]
	},

 

Now when you create a Record Producer CXS Config, it will automatically set "Show on new record" to TRUE. You can update the old Record Producer CXS Configs by changing their Search Context to one with no Search Actions (such as "Response Templates") and then changing it back.

 

However, this did not completely solve the problem.  While now MOST of my Catalog Items properly showed the "Order" button, any Catalog Items with a Request Method set to Request or Submit still showed the order button with no text (and did not show the Order button at all in the details header).  I compared again to the Create Incident producer on an OOB PDI and found one other difference.  By default when the Search Action Configuration for "Order" is generated, it has "Scripted Visibility" checked with the following UI Action visibility script:

visible = (resource.getValue('request_method') !== 'submit') && (resource.getValue('request_method') !== 'request');

So by default it's filtering out the Order button for Request Methods "Submit" and "Request".  I have no idea why you would want to do that - a Request or Submit catalog item can still very much be a solution in incident deflection. I un-checked "Scripted Visibility" and now the Order buttons show everywhere they should!

Hope this helps anyone having this issue!

samruddhi30
Tera Contributor

Button without label showing on contextual search because of missing 'Search Action Configuration'. To add search configuration right click on any label field and select configure list control. Click on Enabled edit button on form to edit it. if omit edit selected then unchecked this box and update this record.

Again, go to record producer configuration and check edit button available. And order action UI and update it.

Order button will display on search context.