Entity mapping for Reference Choice List is not working

Hariprakash
Tera Contributor

Hi All,

I have created a custom topic for Hardware related incident and I have created NLU Intents for this topic and configured necessary utterances. I have created one vocabulary source for list of all hardware and configured in the utterance. I created an mapped entity for this vocabulary source as well.

In the topic, I have used Reference Choice List property to fetch all related subcategory for Hardware from sys_choice table. I have used script to fetch the all these subcategory. Below is my code.

----------Code Starts-----------

var options = []; // add options here...
var cat = 'Hardware';
var table = 'sys_choice';
var query = 'inactive=false^name=incident^element=subcategory^language=javascript:gs.getUser().getLanguage()^dependent_value='+cat;
var getchoicelist = new global.VACustomUtil().getChoiceList(table,query);
var choiceList = JSON.parse(getchoicelist);
for(var i = 0; i< choiceList.length;i++){
options.push(
{'value':choiceList[i].value,
'label':choiceList[i].label});
}
options.push({'value':'previous', 'label':gs.getMessage('Go Back to Previous Step')});
return options;
 
Script include : VACustomUtil()

getChoiceList: function(table,query){
        var options =[];
        var choices = new GlideRecord(table);
        choices.addEncodedQuery(query);
        choices.query();

        while (choices.next()) {
            options.push({
                'value': choices.getValue('value'),
                'label': choices.getValue('label')
            });
        }
        return JSON.stringify(options);
    },

---------Code Ends------------
 
Now, I am trying to auto map this subcategory with use of entity which I have created for vocabulary source. The entity is fetching the correct value from User input. But it doesn't map the subcategory question.
 
Check below screenshots.
Associated the "Hardware" entity in subcategory property.

find_real_file.png

Trying to test the topic.

find_real_file.png

When I am entering the keyword, it is predicting the correct topic and Hardware entity has correct value. But it is not mapping to the reference choice list. 

Can someone please help me to understand why it is not mapping?

Thanks in advance.

Regards,

Hari

 

1 ACCEPTED SOLUTION

Richard Kiss1
Kilo Guru

Hi Hariprakash,

 

The VA using the reference and static choice lists labels, not the values to match with the entity value. Please make sure that the entity values matching the choice labels.

 

Richard

View solution in original post

2 REPLIES 2

Richard Kiss1
Kilo Guru

Hi Hariprakash,

 

The VA using the reference and static choice lists labels, not the values to match with the entity value. Please make sure that the entity values matching the choice labels.

 

Richard

Hariprakash
Tera Contributor

Thank you Richard for your answer. I found there is a space in the label. It is working now after we removed the space from it.