Cannot set value moralis object

my moralis object has the following methods

  setStatus: function(newStatus) {
    console.log("status run");
    this.set("status", newStatus);
    this.save().then(
      (obj) => {
        // Execute any logic that should take place after the object is saved.
        alert("New object created with objectid: " + obj.id);
      },
      (error) => {
        // Execute any logic that should take place if the save fails.
        // error is a Moralis.Error with an error code and message.
        alert("Failed to create new object, with error code: " + error.message);
      }
    );
  },

  removeBuyerId: function() {
    this.set("buyerId", "nil");
    this.save();
  },

it works here

  const order = () => {
    buyerOrder()
      .then((reply) => {
        console.log(reply.getHash().hash);
        obj.setStatus("In Order");
        obj.setBuyerId(user.id);
      })
      .catch((err) => {
        console.log(err);
      });
  };

but not here even though it seemingly the same code

  const claim = () => {
    sellerClaim()
      .then((reply) => {
        console.log(reply.getHash().hash);
        obj.setStatus("Open");
        obj.removeBuyerId();
      })
      .catch((err) => {
        console.log(err);
      });
  };

in the first case ā€˜orderā€™, i can change the status from open to in order but in the second case ā€˜claimā€™ i cannot change the status from in order to open nor change the buyerid field.

in fact for ā€˜claimā€™ i donā€™t even get the log message ā€œstatus runā€. so it seeems the method isnt even called.

any idea? thank you

Hi there, thanks for the post.
You have some of your own functions here like sellerClaim and buyerOrder.
Itā€™s impossible to help without debugging them.

I would recommend removing all of own code and just use the basic .set, .save functions that Moralis offers and rebuild from there and you will find the error.

Hi. Thank you for the reply. I didnā€™t include sellerClaim and buyerOrder becuase they were smart contract that didnā€™t touch moralis. And then the console log message did get printed in the then blocks so it means they were successful. But thanks anyway for the debugging. Iā€™ll try that out and update here if I find the error. :grinning: