I like to remove all DOM data (instances / history) but keep the definition from a test system.
What is the easiest way to do this? or can someone share a code snippet to run in an automation script?
If you are looking to do it yourself, this snippet will retrieve all instances in chunks and deletes them bit by bit, so the script doesn't timeout or run out of memory.
Deleting history should be as simple as replacing "domHelper.DomInstances" with "domHelper.DomInstanceHistory".
var domHelper = new DomHelper(engine.SendSLNetMessages, "mymodule"); PagingHelper<DomInstance> pagingHelper = domHelper.DomInstances.PreparePaging(new TRUEFilterElement<DomInstance>()); while (pagingHelper.MoveToNextPage()) { List<DomInstance> dataTypes = pagingHelper.GetCurrentPage(); foreach (DomInstance dataType in dataTypes) { try { domHelper.DomInstances.Delete(dataType); } catch (CrudFailedException e) { engine.GenerateInformation(e.ToString()); } } engine.KeepAlive(); }
Hi Mieke
The DOM editor script has a delete button on the home screen.
On there, you can select the module, and select that you only want to delete the instances.
I does not delete history though.