Discovered the following resources, but had no luck implementing the solutions they provided to achieve the above:
https://jira.atlassian.com/browse/JRASERVER-12244
I tried all scripts provided, and in all cases, the custom "Hidden" field does get hidden on the Edit screen, but doesn't hide the Comment field (on any screen), which is what I'm trying to achieve. I checked to make sure that there's a separate Screen associated with each Issue Operation (Create/Edit/View) in the Screen Scheme, as I thought that that might be the issue. I made sure to place the script in the Description, and I believe that that part was done correctly as, otherwise, the Hidden field wouldn't be hidden (when I remove the script from the Hidden field's Description, it shows up in the Edit screen, and only the Edit screen). Reindexed (as JIRA kept yelling at my to do so), but that didn't change anything (as expected). Currently running 7.3.3.
Someone mentioned that this can be done using Behaviours as well, so if anyone can provide some direction on how, that would be great as well (in case we can't get the script method to work). There was also a mention of using a CSS Banner method (which I successfully used to hide the Assign button on the View screen using info from another thread), but the example given is for a Transition, and I assume that I would need Screen ID instead of a Transition ID to get that to work.
Looking forward to hearing your suggestions :D
Daniel,
A behaviour script like this should hide the comment field on the "Edit" screen but not any other screen.
def commentField = getFieldById(getFieldChanged())
if (getFieldScreen().name == "Default Screen" && !getActionName()) { // check if on edit screen
commentField.setHidden(true)
}
Josh
Thank you so much Josh!! I set things up exactly as you have them in your screenshot, but unfortunately, with that code, it's not being hidden anywhere. I'm wondering if this is the same reason why the java code didn't work either. Any ideas on what I should check on our setup?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, I'm using JIRA out of the box with no modifications. If you've changed the Screen Schemes, I think it'd be possible for the code to no longer work.
What if you just do this? getActionName() should always return null for the Edit screen, so it will make the comment field hidden.
def commentField = getFieldById(getFieldChanged())
if (!getActionName()) { // check if on edit screen
commentField.setHidden(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You, sir, are a genius!! That did the trick!! Thank you so much for all your help!
Anything I need to keep an eye on with this new code (i.e. unforeseen consequences)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. In addition to hiding the field on the "Edit" screen, this code will hide the comment field on non-workflow screens like "Assign Issue." If you click the "Assign" button, I think you'll see that the screen will no longer have a comment field.
A better way to do it would be to check for the field screen name. Go to "Screen Schemes" in JIRA and find the one of "Edit." My screen name is "Default Screen", as I have not modified any schemes. Yours is likely to be different from the sound of it. See image below.
Once we know what the field screen name really is, we can edit my original script to make it work in a behaviour.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome, that was definitely it, and sorry I missed the part in your original code for the screen name variable (otherwise that would have worked to begin with)!
Excellent customer service, thank you again Josh!! If I could, I would totally give you 5 stars :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad I could help, Daniel! Thanks for using ScriptRunner!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joshua Yamdogo @ Adaptavist,
Thanks for sharing this!
As you mentioned above "In addition to hiding the field on the "Edit" screen, this code will hide the comment field on non-workflow screens like "Assign Issue." If you click the "Assign" button, I think you'll see that the screen will no longer have a comment field. "
Is there a way to avoid hiding a "Comment" filed on the "Assign" issue system screen? But still have it hidden on "Edit" screen...
Many thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bojana Vasic ,
You should be able to simply modify the condition to check the action name to see if the "Assign Issue" action has been pressed
def commentField = getFieldById(getFieldChanged())
if (!getActionName() && getActionName() != "Assign Issue") { // check if on edit screen
commentField.setHidden(true)
}
Perhaps something like this. I've not tested it, but you could add some log.debug statements to see what getActionName() returns when the "Assign Issue" action happens vs the regular Edit action.
Does that make sense?
Regards,
Josh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Joshua Yamdogo @ Adaptavist and @Bojana Vasic ,
Sorry to resurrect an old thread, but we're attempting to do this same thing here, and Comment in still hidden from the assign issue screen.
We have not tried adding a log.debug statement yet, but just wanted to first see if you learned the solution here.
Thanks so much!
Andrew
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Can you use Adaptivist Scriptrunner or you need a javascript code? In Scriptrunner you can use behaviours and you do not need to write any code. You just add a behaviour, then add the comment field to the behaviour and mark the comment field as hidden. That would be all you have to do. It would be hidden on all transation screens. If you need a specific transaction, then you can also configure it in behaviours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Alexey,
Thank you for your speedy reply! As I said above, I don't mind using either method, as long as it works to hide the Comment field JUST on the Edit screen. Is there any chance you can provide some instructions on how to properly do it using Behaviours? Here's what I've done so far:
1) Created Behaviour (named it HideCommentFieldEditScreen)
2) Added mapping for All Projects/All Issue Types
3) Clicked on Fields, added Comment field, clicked Hide
4) Checked a test ticket, and the Comment field is gone from all screens/transitions (except the View screen)
I'm assuming that I would have to add either a serverside script or an initializer to get it to limit the hiding to only the Edit screen, and that's where I'm stuck.
Hope that you or Joshua Yamdogo @ Adaptavist (who was awesome with my last question) can guide me with the above ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried to use the above same code to hide a message custom field on edit screen,but its not working
def PRField = getFieldById(getFieldChanged())
if (!getActionName()) { // check if on edit screen
PRField.setHidden(true)
}
Any help on this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can we go one step further and hide the 'Customer' comments only?
So that even agents can only submit an internal comment on that one screen?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joshua Yamdogo @ Adaptavist
Here is my question
If i Want to Hide the Comment Field on the WorkFlow Transition Screen how can i do that
The above script that you have mention its hiding on Edit screen which is good
But If i want to Hide on Particular Transition Screen How can I achive that can you please help me with script
Thanks,
Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kumar,
Map the necessary Workflow and add Condition to hide the field on the particular Actions (for transition). See the attached screenshot - 1 - Select Guide workflow; 2 - Add Condition; 3 - select whether hide field on the transition screen or show only on this transition; 4 - select necessary transition.
Regards,
Anton
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.