Skip to main content
Since Domo doesn’t currently allow you to specify sync intervals, AppDB can only be set to either 1) not sync at all or 2) sync every 15 minutes. If you would like to conserve credits on syncs, you can create a Workflow to sync on your schedule. This guide leverages Workflows and Code Engine. Please make sure you are familiar with Workflows and Code Engine first.
  1. Create a Workflow that runs at the time you want to sync the collection
  2. Specify which collection you want to sync
  3. Create a Code Engine function to execute a sync, which could be written like this:
const codeengine = require('codeengine');

async function syncCollection(collectionId) {
  // gets the collection
  const collection = await codeengine.sendRequest(
    'get',
    `/api/datastores/v1/collections/${collectionId}`,
  );

  // enables collection sync
  const putBody = { id: collectionId, syncEnabled: true };
  await codeengine.sendRequest(
    'put',
    `/api/datastores/v1/collections/${collectionId}`,
    JSON.stringify(putBody),
  );

  // forces collection sync
  await codeengine.sendRequest(
    'post',
    `/api/datastores/v1/export/${collection.datastoreId}`,
    '',
  );

  // turns off collection sync
  await codeengine.sendRequest(
    'put',
    `/api/datastores/v1/collections/${collectionId}`,
    JSON.stringify({ ...putBody, syncEnabled: false }),
  );
}
  1. Call the new Code Engine function in the Workflow with the collection id