Created
February 27, 2015 15:34
-
-
Save tgtxmorgan/d2dd5deaa2866c7d3ae8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// THIS METHOD IS CALLED WHEN I CLICK THE SUBMIT BUTTON | |
$scope.handleSubmit = function() { | |
alert($scope.currentUser); // WHY DON'T I HAVE CURRENTUSER HERE? | |
sObj = { "sobjectType": "TargetX_SRMb__Application__c", "TargetX_SRMb__Contact__c": $scope.currentUser.ContactId }; | |
angular.forEach($scope.fields, function (f,k) { | |
sObj[f.field_api] = f.value; | |
}); | |
sObj.Deadline__c = $scope.deadline; | |
sObject.upsert(sObj, {}, function (results, event) { | |
if(event.status){ | |
angular.forEach(results, function(result, i){ | |
console.log(result); | |
}); | |
}else{ | |
alert(event.message); | |
} | |
}); | |
} | |
$scope.init = function () { | |
$scope.calculateOptions(); | |
sObject.query("SELECT Id, ContactId FROM User WHERE Id = '{!$User.Id}'", {escape : false}, function(result, event) { | |
$scope.currentUser = result; | |
console.log($scope.currentUser); // THIS LOG SHOWS THAT THE OBJECT WAS SUCCESSFULLY RETRIEVED | |
}); | |
} | |
$scope.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment