title: Cloud code skipping section of code
body: <p>I never learnt javascript so please bear with me. </p>
  
  <p>I have a cloud function that does all but the indicated section (>>): </p>
  
  <pre><code>Parse.Cloud.define("acceptRequest", function(request, response) {
  var user = request.user;
  var requestUser;
  var requestObject;
  var requestId = request.params.objectId;
  
   var query = new Parse.Query(GameRequests);
  query.get(requestId,{
      //Get GameRequest Object - requestObject
      success: function (object) {
  
          var requestObject = object;
  
          var sender = requestObject.get("from");
          var senderId = sender[0];
  
          var query = new Parse.Query(Parse.User);
          query.get(senderId, {
              //From GameRequest Object data, find sender of request "requestUser"
              success: function (userObject) {
  
                  var requestUser = userObject;
  
                  var requestUserList = requestUser.get("SENTrequests")
                  var requestIndex = requestUserList.indexOf(requestId);
  
                  if (requestIndex &gt; -1) {
                              requestUserList.splice(requestIndex, 1);
                      requestUser.set("SENTrequests",requestUserList);
                       if (requestUserList.length = 1) {
                          user.unset("SENTrequests");
                              }
                                              }
  
                  var userList = user.get("RCDrequests");
                  var userIndex = userList.indexOf(requestId);
  
                  if (userIndex &gt; -1) {
                              userList.splice(userIndex, 1);
                      user.set("RCDrequests",userList);
                      if (userList.length = 1) {
                          user.unset("RCDrequests");
                              }
                          }
  
                      requestObject.destroy({
                          success: function(requestObject) {
  
  
                              requestUser.add("partners",user.id);
                              user.add("partners",requestUser.id); 
  
                              var firstmsg = new GameMessage();
                              var secondmsg = new GameMessage();
  
                              firstmsg.set("sender", user.id);
                              firstmsg.set("receiver", requestUser.id);
                              firstmsg.set("sent", 0);
                              firstmsg.set("received", 0);
                              firstmsg.set("receiverName", requestUser.getUsername());
  
                              secondmsg.set("sender", requestUser.id);
                              secondmsg.set("receiver", user.id);
                              secondmsg.set("sent", 0);
                              secondmsg.set("received", 0);
                              secondmsg.set("receiverName", user.getUsername());
  
                              Parse.Object.saveAll([requestUser, user, firstmsg, secondmsg], { useMasterKey: true },{
                           &gt;&gt;       success: function() {
  
                           &gt;&gt;       console.log("Saving messages again");
                           &gt;&gt;       firstmsg.set("otherside", secondmsg.id);
                           &gt;&gt;       secondmsg.set("otherside", firstmsg.id);
                           &gt;&gt;          
                           &gt;&gt;       Parse.Object.saveAll([firstmsg, secondmsg]);
                                  },
                                  error: function(error) {
                                  }
  
                              });
  
                              response.success("Successful");
                          },
  
                          error: function(requestObject, error){
                          }
                   });
  
              },
  
              error: function (userObject,error) {
  
              }
          });
  
      },
  
      error: function (object,error) {
          response.error("Error");
      }
    });
  
  });
  </code></pre>
  
  <p>It is supposed to save the two messages' objectIds so each has a reference to the other.<br>
  What is causing this problem and how can I fix it?</p>
  
  <p>Thank you</p>