You are here

function sf_node_salesforce_form_submit in Salesforce Suite 5.2

Same name and namespace in other branches
  1. 6.2 sf_node/sf_node.module \sf_node_salesforce_form_submit()

File

sf_node/sf_node.module, line 359
Integrates the core node object and various node related modules with the SalesForce API.

Code

function sf_node_salesforce_form_submit($form_id, $form_values) {
  switch ($form_values['op']) {

    // Export the node to Salesforce.
    case t('Export node'):
      if (sf_node_export($form_values['nid'], $form_values['fieldmap'])) {
        drupal_set_message(t('Node successfully exported to Salesforce.'));
      }
      else {
        drupal_set_message(t('An error occurred while exporting the node to Salesforce.  Check the watchdog for more information.'), 'error');
      }
      break;

    // Export changes to Salesforce.
    case t('Export changes to Salesforce'):
      if (sf_node_export($form_values['nid'], $form_values['fieldmap'], $form_values['sfid'])) {
        drupal_set_message(t('Changes successfully exported to Salesforce.'));
      }
      else {
        drupal_set_message(t('An error occurred while exporting the changes to Salesforce.  Check the watchdog for more information.'), 'error');
      }
      break;

    // Import changes from Salesforce.
    case t('Import changes from Salesforce'):
      if (sf_node_import($form_values['sfid'], $form_values['fieldmap'], $form_values['nid'])) {
        drupal_set_message(t('The node has been updated with values from Salesforce.'));
      }
      else {
        drupal_set_message(t('An error occurred while importing the changes from Salesforce.  Check the watchdog for more information.'), 'error');
      }
      break;
  }
}