Tech Doc Content automation from CUI Method Call
Hello,
I've written a CUI method to instantiate a new Tech Doc from within the "Parts" page, and its' fields are set, including which schema to use.
There's a necessity to build out this new corresponding tech doc with a very specific content. I want to insert and start building the Tech Doc programmatically within this method. I've seen this example here:
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:13ea21b3-5e3f-4557-92ff-1de6a15db1ff:type=csharp&text=%2F%2FMethodTemplateName%3DCSharp%3AAras.TDF.ContentGenerator%28Strict%29%3B%0AItemDocumentElement%20targetItem%20%3D%20targetElement%20as%20ItemDocumentElement%3B%0A%0Aif%20%28targetItem%20%21%3D%20null%29%20%7B%0A%09targetItem.ClearChilds%28%29%3B%0A%0A%09%2F%2F%20if%20referenced%20item%20was%20set%2C%20then%0A%09if%20%28%21targetItem.IsEmpty%29%0A%09%7B%0A%09%09TableDocumentElement%20tableElement%20%3D%20%28TableDocumentElement%29%20this.Factory.NewTable%28%22Table%22%2C%203%2C%205%29%3B%0A%09%09tableElement.GetCell%280%2C%200%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20%22Item%20Info%20Table%22%29%29%3B%0A%0A%09%09for%20%28int%20i%20%3D%200%3B%20i%20%3C%20tableElement.CellCount%3B%20i%2B%2B%29%0A%09%09%7B%0A%09%09%09tableElement.MergeCells%280%2C%20i%2C%20MergeDirection.Right%29%3B%0A%09%09%7D%0A%0A%09%09tableElement.GetCell%281%2C%200%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20%22Id%22%29%29%3B%0A%09%09tableElement.GetCell%281%2C%201%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20%22Name%22%29%29%3B%0A%09%09tableElement.GetCell%281%2C%202%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20%22Classification%22%29%29%3B%0A%09%09tableElement.GetCell%281%2C%203%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20%22Status%22%29%29%3B%0A%09%09tableElement.GetCell%281%2C%204%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20%22Date%20of%20creation%22%29%29%3B%0A%0A%09%09tableElement.GetCell%282%2C%200%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20targetItem.ItemId%29%29%3B%0A%09%09tableElement.GetCell%282%2C%201%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20targetItem.GetItemProperty%28%22name%22%2C%20%22%20%22%29%29%29%3B%0A%09%09tableElement.GetCell%282%2C%202%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20targetItem.GetItemProperty%28%22classification%22%2C%20%22%20%22%29%29%29%3B%0A%09%09tableElement.GetCell%282%2C%203%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20targetItem.GetItemProperty%28%22state%22%2C%20%22%20%22%29%29%29%3B%0A%09%09tableElement.GetCell%282%2C%204%29.AddChild%28this.Factory.NewText%28%22Title%22%2C%20targetItem.GetItemProperty%28%22created_on%22%29%29%29%3B%0A%0A%09%09targetItem.AddChild%28tableElement%29%3B%0A%09%7D%0A%7D]
With aras innovator, inn.newItem("tp_block", "tp_GetDocument");, I am able to reference the document I intend to fetch (considering that it exists at this statement, otherwise I also create it first)
My main issue to tackle now is how to, with this document variable in cache, create new Item Document Elements, such as a Break, Chapter, Section, etc. Is this possible? Is there a way to get reference to the root Item Document Element?
Thank you