getFileStoreURL

Uses the data handler getFileStoreURL of the data object to get a pathname for a file. Can be given either a primkey and file name as parameters, or a record with PrimKey and FileName fields.

If you give a record, and the record does not have both PrimKey and FileName fields, an empty string will be returned.

A third parameter can controle whether the file should be downloaded by the browser, or open a preview if the browser supports the file format.

Usage

You can give a specific primary key and file name directly. In this example we have a data object which uses a file store table.

function MyComponent({ record }) {
  return (
    <a
      href={dsMyDataObject.getFileStoreURL(record.PrimKey, record.FileName)}
      alt={record.FullName}
    >
      {record.Title}
    </a>
  );
}

Alternatively, if the data object has both a field called PrimKey and a field called FileName, you can pass the record directly to the method:

function MyComponent({ record }) {
  return (
    <a
      href={dsMyDataObject.getFileStoreURL(record.PrimKey, record.FileName)}
      alt={record.FullName}
    >
      {record.Title}
    </a>
  );
}

API

Last updated

Was this helpful?