title: Parse.com / Javascript - Save users objectid string as user pointer
body: <p>How do I save a user pointer to an object when i have the object id of the user.</p>
  
  <p>I am able to save the object to the class in Parse but the assignee  is always 'Undefined' in Parse.</p>
  
  <p>e.g. I have retrieved the user object and can get the username / object id etc through:</p>
  
  <pre><code>function getUserFromUsername(username) {
  
  Parse.initialize("...", "...");
  
  console.log('The username passed in is: ' + username);
  
  var User = Parse.Object.extend("_User");
  var query = new Parse.Query(User);
  query.equalTo("username", username);
  
  query.first({
       success : function(result) {
          // Do something with the returned Parse.Object values
              var userPointer = new Parse.User();
              userPointer = result;
              console.log(userPointer.get('username')); // this returns the correct username
              return userPointer;
  
      },
      error : function(error) {
          alert("Error: " + error.code + " " + error.message);
      }
  });
  }
  </code></pre>
  
  <p>Which is called from my save task function below: (Note, I've logged all relevant fields and they return as expected.</p>
  
  <pre><code>function saveNewTask(clientName, taskTitle, taskDue, assigneeArray) {
  
  Parse.initialize("...", "...");
  
  var x;
  for (x in assigneeArray) {
  
      var Task = Parse.Object.extend("Tasks");
      var task = new Task();
  
      task.set("title", taskTitle);
      task.set("date", taskDue);
  
      var thisAssignee = GetUserFromUsername(assigneeArray[x]);
      task.set('assignee', thisAssignee);
  
      task.save(null, {
          success : function(task) {
              // Execute any logic that should take place after the object is saved.
              console.log('New object created with objectId: ' + task.id);
          },
          error : function(gameScore, error) {
              // Execute any logic that should take place if the save fails.
              // error is a Parse.Error with an error code and message.
              console.log('Failed to create new object, with error code: ' + error.message);
          }
      });
  }
  </code></pre>
  
  <p>}</p>