The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

OCAPI Flash

Flash is a property of documents and contains special information about the document.

Such information could be:

  • a message that the basket contains a product that is no more available.
  • a message that the basket contains a product that has no price.
  • ... and so on.

It’s currently only used at the basket document. The presence of a flash indicates a reason why the basket can’t yet be submitted. See examples of basket resource.

In the Scripting API, flashes can be read from, added to or removed from a document using the methods addFlash, removeFlash, and flashes or getFlashes(). Flashes can be added to any object within the structure of the document - for example a flash may be added to the baskets billing address with the path $.post_code or to one of the baskets product items with path $.adjusted_price. Before sending the response to the client, such flashes are aggregated to the document and their paths are adjusted appropriately, in our example to $.billing_address.post_code and $.product_items[0].adjusted_price.

Example usage showing addition, listing, and removal of flashes: