Save a Promotion With Its First Code
What It Does
The promotion form creates or edits a campaign and may also create its entered first claim code. These requests commit independently, and failed code creation after a new draft triggers a compensating rename and archive attempt.
The Flow
When Something Fails
Return campaign-write errors and stop before code creation. A failed campaign write retains no newly requested code. Return code failure. After a new draft, attempt withdrawal; after an edit, retain the already saved campaign change. A campaign can be saved without its intended code. If withdrawal fails, report that the draft was saved and its code was not added. Successful withdrawal still returns the original code error. A renamed draft can remain if archive fails; successful withdrawal retains an archived record rather than deleting it.
Open Design Questions
Product should decide whether the composite save needs a single transaction. Until then, staff need to recognize that withdrawal keeps an archived record and that editing followed by code failure does not undo the campaign edit.