diff --git a/Civi/DataProcessor/DataFlow/MultipleDataFlows/SimpleJoin.php b/Civi/DataProcessor/DataFlow/MultipleDataFlows/SimpleJoin.php
index 2a24779302d485e1a9b1482d068e693e738fa674..58f1a54b35df6e4433740bf7e07af08e703856ee 100644
--- a/Civi/DataProcessor/DataFlow/MultipleDataFlows/SimpleJoin.php
+++ b/Civi/DataProcessor/DataFlow/MultipleDataFlows/SimpleJoin.php
@@ -188,7 +188,7 @@ class SimpleJoin implements JoinInterface, SqlJoinInterface {
    */
   public function processConfiguration($submittedValues, SourceInterface $joinFromSource) {
     $left_prefix = $joinFromSource->getSourceName();
-    $left_field = $submittedValues['left_field'];
+    $left_field = $this->ocrrectFieldName($submittedValues['left_field'], $joinFromSource);
     list($right_prefix, $right_field) = explode("::",$submittedValues['right_field'], 2);
 
     $configuration = array(
@@ -200,6 +200,44 @@ class SimpleJoin implements JoinInterface, SqlJoinInterface {
     return $configuration;
   }
 
+  /**
+   * This function corrects the field name.
+   * Basically when we add a join the name of the source is empty but as soon as we save it
+   * the name is set. And the fields have the name of the source in their alias.
+   *
+   * For example if we join on contribution with the left table campaign
+   * our join field is called id (the id of the campaign). The alias of this field
+   * is upon adding _id
+   * but after the source name is set to for example my_campaign. Then the alias becomes my_campaign_id
+   * so we should correct this name.
+   *
+   * @param String $fieldAlias
+   * @param \Civi\DataProcessor\Source\SourceInterface $joinFromSource
+   * @return String
+   */
+  private function ocrrectFieldName($fieldAlias, SourceInterface $joinFromSource) {
+    try {
+      $fields = \CRM_Dataprocessor_Utils_DataSourceFields::getAvailableFieldsInDataSource($joinFromSource, '', '');
+      if (isset($fields[$fieldAlias])) {
+        // No need for correction as the field exists.
+        return $fieldAlias;
+      }
+      $sourceWithEmptyName = clone $joinFromSource;
+      $sourceWithEmptyName->setSourceName('');
+      $fieldsWithoutPrefix = \CRM_Dataprocessor_Utils_DataSourceFields::getAvailableFieldsInDataSource($sourceWithEmptyName, '', '');
+      $fieldKeys = array_keys($fields);
+      $fieldsWithoutPrefixKeys = array_keys($fieldsWithoutPrefix);
+      $key = array_search($fieldAlias, $fieldsWithoutPrefixKeys);
+      if (isset($fieldKeys[$key])) {
+        return $fieldKeys[$key];
+      }
+    } catch (\Exception $e) {
+      // Do nothing.
+    }
+    // We could not convert the field alias so return it as it is.
+    return $fieldAlias;
+  }
+
   /**
    * @param array $configuration
    *