AI Search Results Action parameters

Danny Roso
Tera Contributor

Hi everyone,

 

I would like to get a url parameter of the search results page and pass it from the search results page to the resulting url when clicking a search result so that this url parameter can be used for further processing on the appropriate portal page.

 

With the AI Search Results Action I do not see a possibility to apply the url parameter of the search results page to the resulting url.

 

An alternative would be to store the url parameter in the user session so that it can be picked up at a later stage, but before looking into alternative ways I would like to check here if I am perhaps missing a possibility of AI Search Results Action or perhaps other more convienient ways?

 

 

5 REPLIES 5

Gerard Dwan
ServiceNow Employee
ServiceNow Employee

Hi Danny, 

 

As long as you can infer what the url should be for a given search result, you can do more complex processing view the search scripted post-processor (that is part of the search application config). I would caution against putting too complex or long running scripts in that area because the scripts need to be run prior to rendering the search results screen. 

Hi @Gerard Dwan 

 

I had a similar question, using post processor script I was able to change the title of a single search result card (catalog item) so I am sure the script is actually running.

 

But I when I am using the:

record.setUrl() function to set a custom redirection URL, nothing is happening and upon clicking the search result card it is still opening the original url i.e. the catalog form.

 

script I wrote: 

record.setUrl("https://...");

return;

 

I am missing something here? Please advice

 

 

Danny Roso
Tera Contributor

Hi Gerard,

 

Thank you for your response. When I use gs.getSession().getUrlOnStack() to get to the session url in a post processing script it will return undefined. Do you know a way to get to the url parameter in a post processing script?

Shamus Mulhall
ServiceNow Employee
ServiceNow Employee

Hi @Danny Roso  within the script to get the instance url can you use the following.

 

var instanceUrl=gs.getProperty('glide.servlet.uri');
gs.log("glided url: " + instanceUrl);