Contextual Search in an embedded record producer - handing off cxs_rp_config record or sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 07:45 AM
Summary question: Does anyone know how to hand off a cxs_rp_config record to the 'SC Catalog Item' widget for a record producer?
Details:
We are on San Diego and using the Employee Center. The request is to have an Incident record producer on the front page to have a quick submission option. I copied the ec_dashboard page and customized with a 'SC Catalog Item' widget, and used the containing instance's 'Additional options, JSON format' to set the sys_id for the "Open an IS ticket" rp. This has been working great.
The next request was to have inline contextual searching on the short description field (labeled "Title" on this record producer). I followed the documentation directions "Define contextual search for record producer" and created an entry pointing to the "Open an IS ticket" record producer's "Title" (short_description mapped) field. This created the "contextual_search_results" variable in the record producer as expected, but it would not display.
I added the 'Contextual Search - Inline Results' widget to the variable:
With this in place, the contextual search did work for the record producer when the sys_id was set in the URL parameter, for example - https://myinstance.service-now.com/esc?id=sc_cat_item&sys_id=f8b3d96587fdd91084070d47cebb356c
But on the front page, where the sys_id is set in the JSON options and not in the URL, it doesn't work. My guess is that this is because the widget assumes in this line of code for "config" that it is a parameter, not an option. Note this is the sys_id of the record producer, and is used by the getRPConfig() method to query for the
data.cxs = {
session: gs.generateGUID(),
displayed_on: "record_producer:" + $sp.getParameter("sys_id"),
config: new sn_cxs.CXSUIConfig().getRPConfig($sp.getParameter("sys_id")) || {}, // <- *** right here
property: {
show_meta_data: gs.getProperty("com.snc.contextual_search.widget.form.show_meta_data", false) == "true" || false,
wait_time: parseInt(gs.getProperty("com.snc.contextual_search.wait_time", 500)),
min_length: parseInt(gs.getProperty("com.snc.contextual_search.min_length", 4), 10)
},
So, my preference would be to spoof the parameter sys_id (of the record producer) so the 'Contextual Search - Inline Results' widget sees it as set just the same as if it was in the URL of the page.
Anyone know how I can do this, preferably in the configurable areas of the portal page or with another method that doesn't require customization of the OOB widgets?
- Labels:
-
Service Catalog