Gravatar for debadyuti.sil@gmail.com

Question by Deb, Sep 30, 2014 8:31 PM

How to Get Data of any field after QuerySuccess?

I am getting array of coveo field and value in the result.How to get value of any specific field.For example if my object is Case and my coveo field is @description then how to get description value in result.

$('#search').on('querySuccess', function(e, data) { console.log('==>',data.query.aq); });

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Oct 1, 2014 3:34 AM

The data argument for the QuerySuccess event has a field called results that contains a QueryResults object. From there you can access an array that is also called results that contains the JSON data for each results. Specific fields values are under the raw property, without the leading @. Ex:

data.results.results[0].raw.myFieldName
Ask a question