Quick action for catalog item

snehalataka
Tera Contributor

I tried to configure quick action for catalog item. However its searching catalog items but whenever i am sending it to user its sending only text not linkable card format same like Kb. All the things are configured same like search-kb quick action but for catalog item its not behaving properly.

 

Below is the script using under quick action parameter for catalog

 

var api = new sn_search.ScriptableSearchAPI();
var searchContextConfigId = '269812d447946290ef4b91cd436d4365';
var searchTerm = query;
var disableSpellCheck = false;
var facetFilters = [];
var searchFilters = [];
var requestedFields = {
    sc_cat_item: ['sys_id','text', 'name','short_description']
};
var response = api.search(searchContextConfigId, searchTerm, paginationToken, disableSpellCheck,facetFilters, searchFilters, requestedFields);
results = response.getSearchResults();
items = results.map(function(result) {
    var columns = result.getColumns();
    var fields = {};
    columns.forEach(function(column) {
        fields[column.getFieldName()] = column.getDisplayValue();
    });
    return {
        value: fields['name'],
        label: fields['name'],
        displayValue:result.getTitle(),
        aisDetails: {
            title: result.getTitle(),
            summary: result.getText(),
            detailLabelOne: fields['name'],
            detailLabelSeparator: " ",
            detailLabelType: "inline",
            nextPaginationToken: response.getNextPaginationToken(),
            prevPaginationToken: response.getPreviousPaginationToken()
        }
    };
});
var openedForUser = record.getValue('opened_for');
var filteredItems = sn_snippets.QuickAction.filterReadable(items, 'value', 'sc_cat_item', 'name', openedForUser);
answer = {
    items: filteredItems
};
2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@snehalataka 

how and where have you configured this? please share steps and detailed screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

snehalataka
Tera Contributor

Hi Ankur, I am configuring  this quick action under SOW virtual agent live chat. for that I created one new quick action and under Quick action-> quick action parameter we have added above script. 

 

snehalataka_0-1742365595310.png

In above snap I tried to send catalog item through quick action but it has send name only, not a clickable link. 

And you can see below snap for KB article. 

snehalataka_1-1742366480085.png

I am trying to configure catalog items in this way