Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement