Generating an attachment from field data

Hello, I'd like to generate an attachment based on field data, when the State field becomes a certain value. I already have a script set up to check when State becomes “X” - and in this script, I'm formatting a rich text field the way I want it. Then the user can copy/paste into MS Word. However, it would be better if I could generate a .docx file directly in my script, to better control the formatting. Is there a way to do this? I have read the REST API discussions on the forum and it only seems possible to attach existing files via REST, but in my case I want to create a file attachment “from scratch”. thanks

0
1 comment

Hello! 
Stan from YouTrack Support here! 

Currently, there is no module in YouTrack workflows that generates a .docx file. The workflows run in a sandboxed JavaScript engine on the server, which means you cannot install third-party npm packages, I'm afraid. 

You can consider using the http module to call an external service that generates the .docx for you, then attach the binary response if you need to automate the process. 

Please feel free to reach out anytime if any questions arise. 

0

Please sign in to leave a comment.