Populate a comments box based on a selection from a drop down box?
Is there way to populate a comments box based on a selection from a drop down box?
For example, in a drop down field we have four options to choose from: A, B, C, D. If the user selects the option "A', a certain set of information will be added to comments (or a different field). If option 'B' is selected, a different set of information is automatically added to comments (or a different field).
In other words, I would like a comment to be created in current issue based on the value of a selectable field.
Comments (17)
-
repo owner -
reporter nothing is being inserted into the field I specify. Here's my exact business use case.
We have a field with an ID of 14005 named Standard Equipment. In that fields dropdown there are a number of values to choose from like Accounting, Finance, etc. I would like added to the comments field information for the specific value they choose. For Example, if the user selects Accounting from the dropdown (Standard Equipment field), I would like the comments field to be populated with: Monitor, Keyboard, calculator. Then if they choose the Finance option, the comments field would be populated with: Software, desk, cables.
Is that possible?
-
repo owner The solution I gave you was for creating a new issue comment. Now, I think that what you want to do is to set a custom field called "Comments". I have a pair of questions:
- Which type is custom field Comments?
- Do you want to overwrite the content of Comments custom field, or do you prefer to add new values keeping current content of the field?
-
reporter - Comments is the standard JIRA comments field. I haven't created anything custom when it comes to Comments.
- No overwriting
-
repo owner Then, it should be working. Can you please attach a screenshot of the post-function's tab of the transition where you are trying to create the comments? I would like to see all the post-functions you are executing.
Thanks
-
reporter I must not be adding enough logic?
-
repo owner If you leave parameter Conditional execution empty, the post-function will be executed unconditionally. You can try leaving it empty, and the post-function will be executed.
Can you please attach a screenshot of the post-function's tab of the transition where you are trying to create the comments?
-
reporter That is from the transition i'm attempting to add the comments. It's on the Open transition.
-
repo owner This post-function is "Copy a parsed text to a field", but I told you to use "Add a comment".
Anyway, you can do it also using "Copy a parsed text to a field". I explain you how:
- Select New comment in "Target field" parameter.
- Input the text content of your comment into parameter "Text to be parsed and copied to target field".
I assume that %{14005} is the field code of the drop down custom field you mentioned in the description of the issue. Isn't it?
-
reporter I did find Add a comment and that seems to work! I was able to get the info added to comments. Yes, 14005 is the field code for Standard Equipment. This is the field with the dropdown values to choose from.
Question: Different information needs to be added to the comments per the selection they choose (A, B, C or D). What will that look like in the "Text to be parsed and then copied to target field"?
-
repo owner Yes, that is a possibility, but if the text content of the comment is a short (a single line), then I recommend to use "Set a field as a function of other fields" with a configuration similar to this:
- Field to be checked for matching...: Standard Equipment
- Target field: New comment
Settings rules in this example are:
(Accounting)Monitor, Keyboard, Calculator (Maintenance)Screwdriver, Pliers (Chef)Spoon, Pan, Knife
As you can see, there are many ways to the same thing.
-
reporter I can't see the image you pasted but I applied what you have in the example and it doesn't work. Here's a screenshot of what my logic looks like.
-
repo owner It seems that there is some kind of problem attachments in Bitbucket. I have edited my previous post and explained the values of parameters "Field to be checked for matching..." and "Target field". Please, revise your configuration.
-
reporter That worked. Is there a way to have each value appear on it's own separate line in the comments. For example, if value D under Standard Equipment has the values of pencil, paper, calculator, notebook, can I have those each on their own separate line...
Pencil Paper Calculator Notebook
-
repo owner Use the following setting rules instead:
a(Accounting)"Monitor\nKeyboard\nCalculator" a(Maintenance)"Screwdriver\nPliers" a(Chef)"Spoon\nPan\nKnife"
Don't forget the 'a' prefix, which activates the advanced parsing mode for the value part of the rule.
-
reporter That works. The only change I had to make was one slash instead of two.
Logic: a(Accounting)"Macbook\nPC\nTablet" Results:
Macbook PC Tablet
-
repo owner - changed status to resolved
You are right Scott: only one \ is needed. I have edited my previous post and corrected it.
- Log in to comment
Hi Scott,
Yes, you can do it using "Add a comment" post-function. You should insert in a transition as many instances of this post-function as different comments you have.
Insert a boolean expression in parameter Conditional execution of each post-function, in order to execute only the one corresponding to the current value of the drop down field. The boolean expressions to use are like this one:
replacing nnnnn with the field code of drop down field, and certain_value with the desired value in each post-function.