Dear all,
In a Confluence page, using Confiforms, I try to use "consume" a DB dropdown multiselect values field (cst16000) to a WebService using Rest API Jira (to create a Jira ticket with provide data from my page).
The need is to push all values from this dropdown to the Insight Object Custom Field (customfield_16000) of Jira ticket I want to create.
It works well, except when I select multiple values on my dropdown.
On my IFTTT integration rules, I add a 'No format' block, with this kind of data (below code runs when select only one value)
{ "fields": { "project": { "key": "XXX" }, "reporter" : { "name":"[user.name]" }, "summary": "[entry.summary.escapeJSON]", "description": "[entry.desc1.escapeJSON]", "customfield_16000" : [{"key": "[entry.cst16000.id]"}], "issuetype": { "name": "YYYY" } } }
Manually, I can populate multiple values like this:
"customfield_16000" : [{"key": "KEY1"}, {"key": "KEY2"}],
How I can have all my values under an array ?
In other way, I try to use a Insight Object field type (runs as I can select only one value). But when trying to use an "Insight object (multiselect)", I have no the option to select the Object Type (as proposed with "Insight Object dropdown." So what is the difference between those two kind of fields ?
How I can use Insight Object (multiselect) with the rest api to have the same result ?
thanks in advance.
Regards
I finally found using virtual function:
[[entry.cst16000.transform(id).asArrayOfKVPairs(key)]]
reagrds
ConfiForms has a bunch on "virtual functions" you can apply on the data to transform it the way you need, the full list could be found here - ConfiForms virtual functions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just wanted to add that I changed id to objectKey to make it work. In your example it would be:
[[entry.cst16000.transform(objectKey).asArrayOfKVPairs(key)]]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alex Medved _ConfiForms_ ,
You have helped me with this before where
"customfield_30984": [[entry.FArea.asArrayOfKVPairs(value)]],
worked in the past. This was paired with the dropdown (FArea) that was using Webservice Dynamic Multi label and the dropdown list was populated via an excel attachment. The connection to the attachment breaks and dropdowns appear empty every so often.
So I am trying to switch to a Jira API to get the list of options. From the same Jira project where I am ultimately creating tickets. I switched the dropdown to Webservice Multi Select and loading the options using the following Jira rest API. The dropdown is showing the list of options successfully.
/rest/api/2/issue/createmeta/<project>/issuetypes/9?expand=projects.issuetypes.fields
But while building the Jira payload, the following combos are failing.
[[entry.FArea.asArrayOfKVPairs(value)]],
[[entry.FArea.transform(id).asArrayOfKVPairs(value)]]
[[entry.FArea.transform(objectKey).asArrayOfKVPairs(value)]]
[entry.FArea.transform(id).asArrayMultiSelect()]
I am looking to convert the selection to this format
[{"value": "value1"}, {"value": "value2"}]
Appreciate your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is really not much to guess... How the field is configured (all details)?
Also, have not you tried to figure out why the reading from excel does not work for you? Could it be a permissions issue or it does not work at random?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex, @Alex Medved _ConfiForms_ ,
Sorry, missed your message.
Our guess is the excel link was broken during the AMI rotation due to missing indexes. After reindexing the project it started working. Our Jira admins had to do it for us.
<p>
<ac:structured-macro ac:macro-id="1b6fa537-0202-405a-8220-a84c13af7059" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="mapping">values.(fieldId=customfield_30984).allowedValues|value|value</ac:parameter>
<ac:parameter ac:name="fieldName">FArea</ac:parameter>
<ac:parameter ac:name="fieldLabel">Functional Area Select</ac:parameter>
<ac:parameter ac:name="values">/rest/api/2/issue/createmeta/<project>/issuetypes/9?expand=projects.issuetypes.fields</ac:parameter>
<ac:parameter ac:name="extras">89f846f264788bfaf58c4efbf05de4eb</ac:parameter>
<ac:parameter ac:name="type">wsmultiselect</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
Do you have a concern with using the webservice to pull the list from Jira? I am seeing a couple of issues.
What would be the best way to make one call, cache it and populate select options for all three dropdowns? I am now also wondering at what point using a confiforms form becomes an unnecessary step, I should try to build the form in Jira somehow. I would have done that if I did not need admin privileges to make changes to fields and screens. :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
1. You can switch to some service accounts to do that. (workaround the possibility of expired logins for your users)
2. Yes, it does each request for each field. This should not be a big issue, as the data amounts are small. And when the call is absolutely the same (same URL) - ConfiForms caches it within the same request (user http request)
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1 - The user login actually works well, as the automation uses logged in users identity to create Jira tickets. For now, I will just add a note at the top of the form asking users to re-login if they see the error.
2- Great, I was thinking that too. Yes, it is the exact same request. (/rest/api/2/issue/createmeta/<project>/issuetypes/9?expand=projects.issuetypes.fields) that gets all the metadata for the issuetype. Each webservice dropdown field picks a different root to pull the select options to the matching Jira field.
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another related question. Let me know if I should create a separate thread/post.
The list appears empty to users if they are logged into wiki but not in Jira. What's the best way to force the login while loading the screen. Is there an example where this is done?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suggest to use the service account to load these options and not rely on the application links and if the user is logged in into Jira or not
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not directly related and not necessarily (different modules - field definition and the IFTTT with a possibility use different connection types)
You can have a reporter field to be set explicitly to "current user" ([entry._user]), assuming you have the same user names in Confluence and Jira
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.