Context
I update a Jira issue using a Confiforms form and the 'Confiforms IFTTT Integration Rules' box.
In my form I have two radio button fields both with the options 'yes' and 'no'.
When radio button field A is set to"Yes", I fill a Jira custom field with some content of my form.
When radio button field B is set to "Yes" as well:
I want to append some other content of my form to that same Jira custom field.
I don't think I can append to a Jira custom field in the 'No Format' area directly. That's why I use a Confiforms field that I called 'IftttConstructionField' as a buffer field.
Basic Problem
My problem is that I can't fill that buffer field depending on my two radio button decisions by using a Conditional Statement.
I think the problem is better illustrated in my 2 approaches:
Approch 1 (which is probably the most promising)
I use an IF-function and the virtual function append() outside the 'No Format' area. I use a Confiforms form field called 'IftttConstructionField' to append my content to.
That field 'IftttConstructionField' I use again in the 'No Format' section where I build my json to allocate the value to the Jira custom field 'customfield_19410'.
As far as I understand it from the docs, it is possible to use virtual functions and the IF-function within the IFTTT-Body. That's why I think this could therotically work.
Approach 2
My second approach tries to use the virtual function append() within the 'No Format' area. This way I don't have a problem with the Conditional Statement, but using virtual functions within the 'No format' section doesn't seem to work:
(I tried a lot small syntax changes but maybe never got it quite right)
Alternatives
Of course I could solve this problem in another way. For example by simply using two Jira custom fields.
But using Virtual Functions and IF-Statements when formating json within an IFTTT-Body is a gneral problem to me which I haven't figured out yet.
I appreciate any hints or suggestions!
Versions:
Confluence: 6.5.16
ConfiForms: 2.12.4
That is pretty easy actually...
You just put two [entry.field_name] references together and this is the append.
No need for any virtual function or anything
"customfield_19410":"[entry.somefield] [entry.some_other_field] And some static text can be here, why not!?"
Hello Alex,
thanks a lot for your answer! Actually I’m using your suggestion in simpler scenarios. But in this case I include two ‘yes/no’-questions in my form that have an influence on how my Jira custom field should be populated. Naming my steps might help to clarify my problem:
Because of the static content, I can’t append it like you suggested. Because this would mean that in case my user answers my second question with ‘no’, I have static text in my Jira customfield that I don't want. That’s the reason why I work with conditional statements and virtual functions here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I am confused... still unsure why you need a virtual function of any kind here
What you need is just a Velocity #if #end statements to define and collect information into the "Velocity" template variables
I will give you an example how you can "collect" values into the Velocity defined field and then use it's value in the JSON
Below, I have a form with 2 radio fields (r1 and r2, each having 2 choices 1 and 2)
See how I can format the "description" field based on the choices my user makes on the form
No virtual functions... just pure Velocity templating
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alex,
with your last sample code, you completely solved my problem! Thanks a lot. Great help!
I tried that approach before but I was incapable of simply using the $desc variable again on the right side of the variable assignment like you did it for example in this line:
#set($desc = "$!{desc} [entry.r2.label]")
(I didn't necessarily want to solve this by using virtual functions, but it was the only idea I had left..)
Maybe I should rewrite my headline question to avoid confusing other community users who stumble over this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a little issue, I have my confi but I need to evaluate the value of a combo in the form and based on that value define the label that I will send to the jira task, I have this:
but it shows an error in the line marked in blue
Thanks a lot!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think labels field in Jira expects an array (JSON array)
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.