Service Portal: A variable with contextual search enabled removes the space after typing text.

Lidia Andriancz
Tera Expert

A variable with contextual search enabled removes the space after typing text. When you hit space, the cursor jumps back to the last typed letter. 
I was looking for an answer, and ended up submitting ticket to support. This is the workaround they provided and it worked for me in Washington DC: 

This issue has been identified as associated to a platform bug (PRB1799474). This PRB is tentatively scheduled to be fixed in the Yokohama release.

Workaround:


Open the Contextual Search - Inline Results widget record: <instance>/now/nav/ui/classic/params/target/sp_widget.do%3Fsys_id%3Db001d945d7a43200f2d224837e6103d0%26sysparm_record_target%3Dsp_widget%26sysparm_record_row%3D1%26sysparm_record_rows%3D1%26sysparm_record_list%3DnameSTARTSWITHContextual%2BSearch%2B-%2BInline%2BResults%255EORDERBYname

Make the following changes to the Client Controller:

1. Add to the startSearch function's inputs

Change:


function startSearch(newValue) {


to:


function startSearch(newValue, formValue) {

2. In the startSearch function

Change:

if (!cxs.trigger.field.value || cxs.trigger.field.value !== newValue)
$scope.page.g_form.setValue(cxs.trigger.field.name, newValue);

to:

if (!cxs.trigger.field.value || cxs.trigger.field.value !== formValue)
$scope.page.g_form.setValue(cxs.trigger.field.name, formValue);

3. In the preSearchValidation function

Change:


startSearch(trimmedNewValue);

to:


startSearch(trimmedNewValue, newValue);

4. In the preSearchValidation function

Change:


cxs.trigger.timeout = $timeout(startSearch, cxs.property.wait_time, true, trimmedNewValue);

to:

cxs.trigger.timeout = $timeout(startSearch, cxs.property.wait_time, true, trimmedNewValue, newValue);

 

Good luck 🙂

0 REPLIES 0