imports/vx/server/code/vxapp.js
/**
     * Check all collections in source domain to ensure that name fields are present
     * and unique for all records.
     *
     * @param {object} formObject Form object from deployment modal.
     * @return {object} Result object.
     */
Check all collections in source domain to ensure that name fields are present
and unique for all records.

@param {object} formObject Form object from deployment modal.
@return {object} Result object.
Check all collections in source domain to ensure that name fields are present and unique for all records . @param { object } formObject Form object from deployment modal . @return { object } Result object .
checkSourceDomainNames(formObject) {
        try {
            const messages = []
            const deploymentCollections = VXApp.getAppDeploymentCollections()
            _.each(deploymentCollections, collection => {
                const alreadyReported = []
                _.each(collection.find( { domain: formObject.sourceDomain, dateRetired : { $exists : false } } ).fetch(), record => {
                    if (!record.name) {
                        messages.push( { key : "common.alert_deployment_name_missing", variables: { collectionName : collection._name } } )
                        return
                    }
                    const count = collection.find( { domain: formObject.sourceDomain, dateRetired : { $exists : false }, name : record.name } ).count()
                    if (count > 1 && !alreadyReported.includes(record.name)) {
                        alreadyReported.push(record.name)
                        messages.push( { key : "common.alert_deployment_name_duplicate", variables: { collectionName : collection._name, name : record.name } } )
                        return
                    }
                })
            })
            if (messages.length === 0) {
                return { success : true, icon : "ENVELOPE", key : "common.alert_transaction_success" }
            }
            let issues = ""
            messages.forEach(message => {
                issues += Util.i18n(message.key, message.variables) + "\n"
            })
            return { success : false, key: "common.alert_deployment_name_issues", variables : { issues } }
        }
        catch (error) {
            OLog.error(`vxapp.js deploymentMessage unexpected error=${error}`)
            return { success : false, icon : "BUG", key : "common.alert_unexpected_error", variables : { error : error.toString() } }
        }
    }
checkSourceDomainNames ( formObject ) { try { const messages = [ ] const deploymentCollections = VXApp . getAppDeploymentCollections ( ) _ . each ( deploymentCollections , collection => { const alreadyReported = [ ] _ . each ( collection . find ( { domain : formObject . sourceDomain , dateRetired : { $exists : false } } ) . fetch ( ) , record => { if ( ! record . name ) { messages . push ( { key : "common.alert_deployment_name_missing" , variables : { collectionName : collection . _name } } ) return } const count = collection . find ( { domain : formObject . sourceDomain , dateRetired : { $exists : false } , name : record . name } ) . count ( ) if ( count > 1 && ! alreadyReported . includes ( record . name ) ) { alreadyReported . push ( record . name ) messages . push ( { key : "common.alert_deployment_name_duplicate" , variables : { collectionName : collection . _name , name : record . name } } ) return } } ) } ) if ( messages . length === 0 ) { return { success : true , icon : "ENVELOPE" , key : "common.alert_transaction_success" } } let issues = "" messages . forEach ( message => { issues += Util . i18n ( message . key , message . variables ) + "\n" } ) return { success : false , key : "common.alert_deployment_name_issues" , variables : { issues } } } catch ( error ) { OLog . error ( ` ${ error } ` ) return { success : false , icon : "BUG" , key : "common.alert_unexpected_error" , variables : { error : error . toString ( ) } } } }
Check all collections in source domain to ensure that name fields are present
 and unique for all records.
Check all collections in source domain to ensure that name fields are present and unique for all records .