Result Objects

result objects contain the return data for a specific entity being looked up

User Defined Properties

The next parameter in the callback function is an array of result objects. Result objects contain the following properties:

entity

required | object

The entity object for this result that was passed in via the entities parameter of the doLookup method. You should treat the entity object passed to the doLookup method as being immutable (i.e., you should not change any properties on the entity object).

displayValue

optional | string | default: entity.value

A string value that can be used to change how the entity is displayed in the notification window. By default this value is set to entity.value. In general you will not include this value and let the default value be used.

isVolatile

optional | boolean | default: false

If set to true, this result object will not be be cached. The default value is false meaning all result objects are cached in the Integration cache.

data

required | object

Contains contextual data for the entity. If set to null, indicates to the Polarity caching system that no results are available for the specified entity.

data.summary (required | array of strings)

An array of strings that are converted into summary tags within the notification window. Note that these strings support HTML markup.

data.details (required | object)

Data you would like to return from the integration and make available to the template and component logic. If you are using the default template then the values contained within the details object will be rendered into a key-value table.

// example results array containing two result objects.  
// One result object with data, and one without
let results = [
    {
        entity: entityObject1,
        displayValue: entityObject1.value.toUpperCase(),
        isVolatile: false,
        data: {
            summary: ['Tag 1', 'Tag2'],
            details: {
                rows: [
                    {
                    email: 'ed@polarity.io'                    
                    }
                ]
            }
        }
    },
    // this entity object had no results so we set `data` to null
    // this indicates to the caching system that we should cache the
    // fact that there was no data for this lookup
    {
        entity: entityObject2,
        data: null            
    }
]

Enrichment Properties

In addition to properties that are defined by the integration developer, the Polarity Server will enrich the result object with additional information. The following properties are added to your result object and are available in your templates and component files.

isCached

Polarity adds an isCached field to the result object. You can use this to check whether or not a result is being returned from the integration cache.

Last updated