Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Save a default value to Jira issue when confiforms text field is empty on Submit

Adrian M
Contributor
July 18, 2023

I'm trying to set a default value to Jira if a confiforms text input is empty. I have tried various ways but it does not save the value of the textbox in Jira if the textbox was empty on submit.

 

Field macro:

MyInput (text)

 

Rules macro:

Field name - MyInput

Condition - MyInput:[empty]

Execute only on user action - checked (I do not want to show this default value on the form)

Action to execute - set value (or set value if empty)

Values to set - MyInput=No Value Specified

 

The issue is successfully created in Jira but the value set in the confiforms rules macro does not get saved in the Jira issue.

2 answers

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
July 19, 2023

Hi @Adrian M 

Is this a question about the ConfiForms plugin?

Alex

Adrian M
Contributor
July 19, 2023

Hi @Alex Medved _ConfiForms_ Yes this is about confiforms plugin. I've edited the title to indicate that.

Alex Medved _ConfiForms_
Community Champion
July 19, 2023

OK, will add a relevant tag/label as well

However, I dont quite understand this question in the ConfiForms context.

How is this related to a Jira issue you have mentioned? Does your form creates a Jira issue on form submit and all you want is to save back the Jira issue key of the created issue? Is that what you want?

Alex

Adrian M
Contributor
July 19, 2023

The form creates a Jira issue.

The form has a textbox that isn't required to have a user input.

Upon submit, if the user did not input any value in that textbox, then save a default value value to Jira for that field.

Alex Medved _ConfiForms_
Community Champion
July 19, 2023

What does it mean 

save a default value value to Jira for that field

Save something into Jira ticket? Updating Jira ticket?

Or when you create a Jira ticket and the value in ConfiForms for some field is empty then something else should be saved to Jira?

Alex

Adrian M
Contributor
July 19, 2023

Only on save. No update.

Or when you create a Jira ticket and the value in ConfiForms for some field is empty then something else should be saved to Jira?

This.

Alex Medved _ConfiForms_
Community Champion
July 19, 2023

So, this question is about how to map a value for some field in JSON mapping?

How is this done now?

Alex

Adrian M
Contributor
July 19, 2023

The mapping is done in the IFFFT macro.

Example:

I have a textbox on the form to capture info. The form field is not required. This form field is mapped to the Acceptance Criteria Jira field.
Hence if the user submits the form without a value in that form field, then I'd like to save the text "No Value Specified" in the Acceptance Criteria Jira field.

If the user does input a value in the form text box, then that value is saved to the Jira Acceptance Criteria field. <- I have this working fine. 

Alex Medved _ConfiForms_
Community Champion
July 19, 2023

I will try again...

So, how do you have this currently in your JSON mapping?

Adrian M
Contributor
July 19, 2023

Mapping as follows:

 

{ "fields" :

{ "project": { "key": "[entry.JiraProjectKey]" },

"issuetype" : { "name": "[entry.IssueType]" },

"summary" : "[entry.Summary.id.escapeJSON]",

"customfield_14400" : "[entry.AcceptanceCriteria.escapeJSON]"      

}

Alex Medved _ConfiForms_
Community Champion
July 19, 2023
#if(${AcceptanceCriteria})
"customfield_14400" : "[entry.AcceptanceCriteria.escapeJSON]"      
#else
"customfield_14400" : "No Value Specified"      
#end

See more https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-CreateJiraIssue

Alex

Adrian M
Contributor
July 19, 2023

Thanks Alex!

I was hoping to keep the logic out of the IFFFT macro and do it using the form macros. But I guess doing and IF/Else statement in the IFFFT macro is the way to go.

Alex Medved _ConfiForms_
Community Champion
July 19, 2023

Well, you can set up another IFTTT just before the one that runs the "create Jira issue" and set it up in a way that when AcceptanceCriteria is empty then you update the record and set it's value to "No Value Specified"

Alex

Like Adrian M likes this
0 votes
Carla Ann Rowland
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2023

Did you try [null] instead of empty?


Adrian M
Contributor
July 19, 2023

I just did. It didnt work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events