imports/vx/both/code/vxapp.js
/**
     * For definitions that have the lookup attribute, lookup and return the effective value
     * from another record. In such instances, the spreadsheet cell contains a key used to
     * refer another collection. This is akin to a foreign-key lookup.
     *
     * @param {string} value Value (key) from spreadsheet cell.
     * @param {object} definition Import schema definition.
     * @param {number} index Index of row containing value.
     * @param {array} messages Array of messages.
     * @param {string} fieldIdKey i18n bundle key of field-identifier message.
     * @param {object} fieldIdVariables Variables to insert into field-identifier message.
     * @return {?} Value looked up from another record.
     */
For definitions that have the lookup attribute, lookup and return the effective value
from another record. In such instances, the spreadsheet cell contains a key used to
refer another collection. This is akin to a foreign-key lookup.

@param {string} value Value (key) from spreadsheet cell.
@param {object} definition Import schema definition.
@param {number} index Index of row containing value.
@param {array} messages Array of messages.
@param {string} fieldIdKey i18n bundle key of field-identifier message.
@param {object} fieldIdVariables Variables to insert into field-identifier message.
@return {?} Value looked up from another record.
For definitions that have the lookup attribute lookup and return the effective value from another record . In such instances the spreadsheet cell contains a key used to refer another collection . This is akin to a foreign - key lookup . @param { string } value Value ( key ) from spreadsheet cell . @param { object } definition Import schema definition . @param { number } index Index of row containing value . @param { array } messages Array of messages . @param { string } fieldIdKey i18n bundle key of field - identifier message . @param { object } fieldIdVariables Variables to insert into field - identifier message . @return { ? } Value looked up from another record .
lookupValue(uploadStats, value, definition, index, messages, fieldIdKey,
        fieldIdVariables) {
        const coll = Util.getCollection(definition.collection)
        const partialValueRegex = new RegExp(value, "i")
        const selector = {}
        if (definition.collection === "users") {
            selector["profile.domains.domainId"] = uploadStats.domain
        }
        else {
            selector.domain = uploadStats.domain
        }
        selector[definition.retiredDatePath] = { $exists: false }
        selector[definition.keyPropertyName] = partialValueRegex
        const record = coll.findOne(selector)
        if (record) {
            return record[definition.returnProperty]
        }
        const result = { success : false, icon : "TRIANGLE", key : "common.invalid_key" }
        VXApp.validateCreateMessage(result, index, messages, fieldIdKey, fieldIdVariables, value)
        return false
    }
lookupValue ( uploadStats , value , definition , index , messages , fieldIdKey , fieldIdVariables ) { const coll = Util . getCollection ( definition . collection ) const partialValueRegex = new RegExp ( value , "i" ) const selector = { } if ( definition . collection === "users" ) { selector [ "profile.domains.domainId" ] = uploadStats . domain } else { selector . domain = uploadStats . domain } selector [ definition . retiredDatePath ] = { $exists : false } selector [ definition . keyPropertyName ] = partialValueRegex const record = coll . findOne ( selector ) if ( record ) { return record [ definition . returnProperty ] } const result = { success : false , icon : "TRIANGLE" , key : "common.invalid_key" } VXApp . validateCreateMessage ( result , index , messages , fieldIdKey , fieldIdVariables , value ) return false }
For definitions that have the lookup attribute, lookup and return the effective value
 from another record.
For definitions that have the lookup attribute lookup and return the effective value from another record .