Add additional field before watchAddress

I want the addresses that get synced on calling “watchAddress” to have an additional column “group” but I dont know how to do it since “watchAddress” is already a predefined function.

Moralis.Cloud.define("syncAddress", async request => {
  const address = request.params.address.toLowerCase();
  const sync_historical = request.params.sync_historical;
  const group = request.params.group;   //want to add this to the object that is getting stored after watchAddress

  if (!address) return;

  //check if address already synced
  const query = new Moralis.Query("_AddressSyncStatus");
  query.equalTo("address", address.toLowerCase());
  const count = await query.count();
  if (count > 0) return;

  logger.info("sync address " + address);
  return await Moralis.Cloud.run(
    "watchEthAddress",
    { address: address, sync_historical: sync_historical },
    { useMasterKey: true }
  );
});

Since all the watched address are stored under same database class, you can manually create the column in the class.
Does that solve your problem?

Not really because I was looking for a wayto store that new columns value before the address gets synced into _AddressSyncStatus. My Solution right now is to wait til it is synced, query the last created object and append that field. I was looking for a way to pass that value into the watchEthAddress function tho

you could try to use beforeSave maybe?

the column will also be present for the entire table for any watch addresss