# Undo / Redo Transaction Fails

**URL:** <https://forums.unrealengine.com/t/undo-redo-transaction-fails/395895>\
**Category:** C++\
**Tags:** undo, unreal-engine, editor, UE4, question, CPP\
**Created:** [June 8, 2017, 5:44pm UTC](https://forums.unrealengine.com/t/undo-redo-transaction-fails/395895 "2017-06-08T17:44:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [June 8, 2017, 5:44pm UTC](https://forums.unrealengine.com/t/undo-redo-transaction-fails/395895/1 "2017-06-08T17:44:35Z")

</div>

Not sure what I’m doing wrong here. I’m creating a custom module-based editor for a class, and I’m trying to add undo and redo support for adding and removing modules.

Here’s an example of what I’m doing:

Code:

```
// Create an Undoable Transaction
{
	FScopedTransaction Trans = FScopedTransaction(LOCTEXT("CreateOrdModule_Transaction", "Create Module"));
	CurrentTemplate->Modify();

	// Notify Template
	CurrentTemplate->PreEditChange(nullptr);

	// Construct Module and add to selected emitter
	UST_OrdnanceModule* NewModule = NewObject<UST_OrdnanceModule>(CurrentTemplate, NewModuleClass, NAME_None, RF_Transactional);
	NewModule->Modify();
	NewModule->SetToSensibleDefaults();
	NewModule->SetTransactionFlag();

	CurrentTemplate->OrdnanceModules.Add(NewModule);

	CurrentTemplate->OnModulesUpdated();
	CurrentTemplate->PostEditChange();

	ForceRefresh();
}

```

But if I call Undo after running this transaction, the module is NOT removed from the array. The Array is a UPROPERTY with no extra meta data.

What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![daviddimech](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@daviddimech](https://forums.unrealengine.com/u/daviddimech)\
**Post date:** [October 13, 2023, 1:11pm UTC](https://forums.unrealengine.com/t/undo-redo-transaction-fails/395895/2 "2023-10-13T13:11:11Z")

</div>

Hi… I know it’s been a while, but I’m trying to understand the Transaction paradigm. Have you gained any extra insight about this topic that you can share? Thanks! 🙂
