Configure Custom action for Word Generator
Copy
To generate Word or PDF documents using this generator, it can be configured as a custom action or added to CUI menus within Innovator. Below are the steps to use it via a custom action:
- Create a custom action on the context item type.
- Attach a client method that calls the server method “dg_WordDocument_GenerateDocument”. This server method internally utilizes the DocumentService from the Document Generator to process and generate the Word or PDF document.
The method “dg_WordDocument_GenerateDocument” can be executed on context item, which will be used to replace the properties values in Document template.
e.g.Additionally, a custom server method can be introduced to modify values on the context item before processing. Instead of directly invoking the ‘dg_WordDocument_GenerateDocument’ method, you can create a separate method that sets the required values on the context item. After that, the DocumentService object can be instantiated and the relevant APIs can be called.
e.g.
Item contextItem = inn.newItem(itemType, “get”);contextItem.setID(itemId);contextItem = contextItem.apply();Prorigo.Plm.DocumentGenerator.IDocumentService documentService = new Prorigo.Plm.DocumentGenerator.Aras.DocumentService(inn,CCO);var fileItem = inn.newItem(“File”);var fileId =documentService.GenerateWordDocument(contextItem,"GetDocumentAssociationJson”,false); //Boolean parameter to indicate file to be checked in to item as per configuration or notfileItem.setID(fileId);var resultItem = fileItem.apply(“get”);return resultItem;