Hello Dojo community,
I have a requirement to edit (CRUD) instances of exiting Dataminer Object Model programmatically from within a custom API automation script.
I found the following references:
https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Utils.DOM.html
https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Utils.DOM.Builders.html
The way I understand it, to i.e. create a new instance I need to do the following:
DomCache dom = new DomCache(messageHandler, moduleId);
DomHelper helper = dom.Helper;
DomInstanceBuilder domInstanceBuilder = new DomInstanceBuilder();
domInstanceBuilder.WithID(guidId);
DomInstance newDomInstance = domInstanceBuilder.Build();
newDomInstance.SetFieldValue("SectionName", "FieldName", "Initial Value", dom);
DomInstanceCrudHelperComponent instanceCrudHelp = helper.DomInstances;
instanceCrudHelp.Create(newDomInstance);
Questions:
- Is this the correct/optimal way?
- How can GUID for the new instance be auto generated?
- What is the recommended implementation of the MessageHandler method passed via the Func delegate when creating the DomCache object.
Many thanks.
Pawel.
Hi Pawel,
The answer of Tom will set you on your way using the DOM utils NuGet. This NuGet can be very handy, definitely when you are building a complete solution that relies on DOM.
Do note however that using this NuGet is not a requirement to build the script you need. You can also create or update DOM instances using the core DOM API. You are free to choose whichever seems easiest to you. Here are some references on the core DOM API:
https://docs.dataminer.services/user-guide/Advanced_Modules/DOM/DomHelper_class.html#crud-methods

Hi Thomas,
The links have exactly the information I need. Somehow I had missed it before.
Thank you.