/**
  * Get fields for the form's SObject type
  * @param object
  * @return array
  */
 public function getSObjectFields($dc)
 {
     $arrOptions = array();
     $objFormField = \FormFieldModel::findByPk($dc->id);
     if ($objFormField === null) {
         return $arrOptions;
     }
     $objForm = \FormModel::findByPk($objFormField->pid);
     if ($objForm === null) {
         return $arrOptions;
     }
     if ($objForm->useSalesforce && $objForm->salesforceAPIConfig && $objForm->salesforceSObject) {
         try {
             $objClient = Salesforce::getClient($objForm->salesforceAPIConfig);
             $arrConfig = $GLOBALS['TL_SOBJECTS'][$objForm->salesforceSObject];
             $strClass = $arrConfig['class'];
             if (class_exists($strClass)) {
                 $objResults = $objClient->describeSObjects(array($strClass::getType()));
                 $arrFields = $objResults[0]->getFields();
                 foreach ($arrFields as $field) {
                     if (!$field->isCreateable()) {
                         continue;
                     }
                     $arrOptions[$field->getName()] = $field->getName();
                 }
             }
         } catch (\Exception $e) {
         }
     }
     return $arrOptions;
 }
 /**
  * Connect to Salesforce.com 
  *
  * @access		protected
  * @return		void
  */
 protected function connectToSalesforce($intConfig)
 {
     try {
         if ($this->objClient === null) {
             \System::log('Send data to Salesforce: CONNECT', __METHOD__, TL_FORMS);
             $this->objClient = Salesforce::getClient($intConfig);
         }
         return true;
     } catch (\Exception $e) {
         \System::log('Salesforce.com error: ' . $e->getMessage(), __METHOD__, TL_ERROR);
     }
     return false;
 }
 /**
  * Get a property value from an "any" XML property
  *
  * @access	public
  * @param 	string
  * @param 	string
  * @return 	string
  */
 public static function getPropertyValueFromAnyString($strAny, $strTagName)
 {
     return str_ireplace(array("<sf:{$strTagName}>", "</sf:{$strTagName}>"), '', strval(Salesforce::getSectionOfString($strAny, "<sf:{$strTagName}>", "</sf:{$strTagName}>")));
 }