function crmdata($session, $email)
 {
     global $dictionary;
     global $app_list_strings;
     global $current_user;
     global $beanList, $beanFiles;
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', 'Accounts', 'read', 'no_access', new SoapError())) {
         echo "No access";
         return;
     }
     $field_list = array();
     $config = new ZendeskWidgetConfig();
     foreach (query_module_access_list($current_user) as $module) {
         if ($object_name = $beanList[$module]) {
             $field_config = $config->getFields($module);
             if ($field_config != null && $field_config != '') {
                 $field_list[$object_name] = $field_config;
             }
         }
     }
     $root = new SimpleXMLElement('<records></records>');
     $ea = new EmailAddress();
     $beans = $ea->getBeansByEmailAddress($email);
     while ($bean = array_pop($beans)) {
         if (isset($field_list[$bean->object_name])) {
             $record = $root->addChild('record');
             $record->addChild('id', $bean->id);
             $record->addChild('url', htmlspecialchars("/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}"));
             $record->addChild('label', $bean->name);
             $record->addChild('record_type', $bean->object_name);
             $fields = $record->addChild('fields');
             foreach (split(',', $field_list[$bean->object_name]) as $name) {
                 $field_meta = $dictionary[$bean->object_name]['fields'][$name];
                 if ($field_meta['type'] == 'relate') {
                     if ($field_meta['dbType'] == 'id') {
                         $beanType = get_singular_bean_name($field_meta['module']);
                         $newBean = $this->getBeanInstance($beanType);
                         $newBean->retrieve($bean->{$name});
                         $beans[] = $newBean;
                         continue;
                     }
                 }
                 $field = $fields->addChild('field');
                 $field->addChild('label', translate($field_meta['vname'], $bean->module_dir));
                 $value = $bean->{$name};
                 if ($field_meta['type'] == 'enum') {
                     $value = $app_list_strings[$field_meta['options']][$bean->{$name}];
                 }
                 $field->addChild('value', $value);
             }
         }
     }
     return $root->asXML();
 }