![Nikolay Ruban's picture Nikolay Ruban's picture](https://www.cmcrossroads.com/sites/default/files/styles/profile-pic/public/pictures/picture-103249-1372153812.jpg?itok=RT1-TmG_)
what about removing unnecessary items from dropdown on the fly? It is not secure, some "hacker" can easily trick the system and add attach, but for Intranet and loyal employees it should work. :)
I need to be able to restrict Adding/editing attachments based on where the person is in the workflow. Is that possible? if so, how?
what about removing unnecessary items from dropdown on the fly? It is not secure, some "hacker" can easily trick the system and add attach, but for Intranet and loyal employees it should work. :)
Using JavaScript you can remove options from actions dropdown, javascript can be added on stage of template rendering. You'll have to check ITem state and .WriteStream some javascript code to template being rendered. Later, o n client side, javascript will be run and 'll remove al unnecessary options from dropdown menu.
Can you give me an example of how to do this? I am still fairly new to scripting. Would I add this javascript to both the state and transition forms where I do not want to allow attachments?
Yep, you'll have to add TTScript call to all templates where action dropdown is shown and should be "fixed". But in TT 6.1 this dropdown is loaded in separate frame with all transition buttons, called like formbuttons.
Here is link with small example adding code to template: http://bit.ly/fmufWC
In your case you'll have to do following:
- add $SCRIPT(ModifyActionDropdownForUser) call in proper templat. I preffer adding within javascript page init code.
- create TTScript(ModifyActionDropdownForUser)
Option Explicit
Dim vbCr , vbLf , vbCrLf , vbEol , vbQuote , vbSingleQuote , vbHtmlNewLine
vbCr = Chr(13)
vbLf = Chr(10)
vbCrLf = vbCr & vbLf
vbEol = "<BR>" + vbCrLf
vbHtmlNewLine = "<BR>" + vbCrLf
vbQuote = Chr(34)
vbSingleQuote = Chr(39)
Call Ext.WriteStream("//ModifyActionDropdownForUser" & vbCrLf )
Call Ext.WriteStream("alert('Hello World. Here we have to add code for modifying Action DropDown.');")
This is the basics. Hope this will help you or someone who will be interested in calling adding javascript within teamtrack templates via teamscript.