Skip to main content

Write a field only on create

The route "Bestellungen Webshop" creates orders from the shop as documents in SAP Business One and updates them when the shop sends an order again. The shop sends the customer's requested date along, requested_date, and the route writes it into DocDueDate. But the delivery date is committed by the back office: on October 8, 2026 it enters October 16, 2026 for order WS-2026-104870. If the customer then increases the quantity in the shop, the shop sends the order again — and the route resets the date to the requested October 14, 2026.

This how-to sets the DocDueDate row so that it goes into a new document only. At the end, Write is set to Only on create: the shop's requested date is the proposal for the new document, and afterwards the date stays as the back office set it. If both sides change the same field and one side should win case by case, that belongs in a rule — see Decide which side wins in a field conflict.

What you need​

  • The permission Routes at the level Full — see Permissions.
  • A route whose step in the mode Write creates and updates records — write intent Create or update. Only there is the setting offered.
  • Starting point: Configuration → Routes → the route → Mapping tab.

Xchange saves every entry automatically. It takes effect in operation only with the activated configuration snapshot.

1. Find the row​

On the Mapping tab, find the row of the target field, here DocDueDate. It reads requested_date and formats it like DocDate via Format date, format ISO date (YYYY-MM-DD). How a row is created is described in Routes — Mapping.

2. Choose "Only on create"​

  1. Click the gear at the end of the row.
  2. In the dialog, switch to the Options tab.
  3. Under Write, choose Only on create.
  4. Close the dialog.

The Options tab of the DocDueDate row: Write is set to "Only on create".

Whether Xchange creates or updates is decided at the target: if the lookup via NumAtCard finds the document, Xchange updates it, and the DocDueDate row does not go along. The Change detection setting disappears from the tab; what that means for the comparison and what Validate reports on the setting is described in Routes — Mapping.

3. Validate and activate​

The change is in the draft. Validate it and activate it — the way there is described in Validate and activate.

After that, the next run creates a new order with the requested date. If the shop sends WS-2026-104870 again with the quantity 3, the run updates the line, and DocDueDate stays at October 16, 2026.

Set it back to "Always"​

Open the Options tab of the row as in step 2 and choose Always under Write. Then DocDueDate goes into the document again with every delivery. An exclusion from Change detection that the row had before applies again. This change, too, takes effect only with the activated configuration snapshot.

What comes next​

What a run sent to SAP Business One is shown by the sent message of its job in the History: when WS-2026-104870 is updated, DocDueDate is not in it. How to find the job is described in Find and trace a single job.

See also​