You are here

function sf_user_salesforce_form_submit in Salesforce Suite 5.2

Same name and namespace in other branches
  1. 6.2 sf_user/sf_user.module \sf_user_salesforce_form_submit()

File

sf_user/sf_user.module, line 276
Integrates the core user object and profile module with the Salesforce API.

Code

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

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

    // Export changes to Salesforce.
    case t('Export changes to Salesforce'):
      if (sf_user_export($form_values['uid'], $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_user_import($form_values['sfid'], $form_values['fieldmap'], $form_values['uid'])) {
        drupal_set_message(t('The user 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;
  }
}