Technical Documentation - created_by_id and affected_part output
I am using the Technical Documentation application to create reports for the Quality Management qs_NCR ItemType. One of the qs_NCR properties is the affected_part which is implemented as an Item ItemType. I have also implemented a foreign property that refers to the affected_part's name.
The method I am using to get the NCR information is:
//MethodTemplateName=CSharp:Aras.TDF.ContentGenerator(Strict);ItemDocumentElement targetItem = targetElement as ItemDocumentElement;if (targetItem != null) {
TableDocumentElement tableElement1 = (TableDocumentElement) this.Factory.NewTable("Table", 1, 4);
tableElement1.GetCell(0,0).AddChild(this.Factory.NewText("Title", "Part Name:")); tableElement1.GetCell(0,1).AddChild(this.Factory.NewText("Text", targetItem.GetItemProperty("_affectedpartnumber", " "))); tableElement1.GetCell(0,2).AddChild(this.Factory.NewText("Title", "Initiator:")); tableElement1.GetCell(0,3).AddChild(this.Factory.NewText("Title", targetItem.GetItemProperty("created_by_id", " ")));
targetItem.AddChild(tableElement1);
}
The output is the created_by_id id, not the user's name.
What is the most efficient way of outputting the user's name?
AJ
Thanks for your response. Based on your feedback I have implemented:
Innovator inn = this.Factory.InnovatorInstance;
Item item = inn.newItem("User", "get");
item.setID(targetItem.GetItemProperty("created_by_id", " "));
Item results = item.apply();
tableElement1.GetCell(0,4).AddChild(this.Factory.NewText("Title", results.getProperty("keyed_name")));