How to update values on Jira based on the selection from ConfiForm (Web Service Request)?

Md Pervez Nawaz March 24, 2022

I have been trying to put a condition on ConfiForm in order to update Jira ticket based on user selection on the ConfiForm, but it is not able to create Jira ticket. The code is working fine without the condition.

The same code is working when I am using "Create Jira Issue" Action. But While trying with Web Service Request it is not working.

Example condition, where I am trying to put label on Jira based on whether the user has attached file or not, "fi" is the field for attachment:

#set($attachment = "[entry.fi]")


#if($attachment == "")
    "labels": ["ContentNA"],
#else
    "labels": ["Content"],
#end

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
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.
March 24, 2022

The contents is processed absolutely the same way - so if it works for "Create Jira issue" then it should work for "Web service request"

See also https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-CreateJiraIssue for examples on how to check fields for values...

If an attachment IS a file field then checking it for empty value like that will never work. 

As it is a "multi-value" field and should be checked with isEmpty function

Alex

Md Pervez Nawaz March 24, 2022

Thanks @Alex Medved _ConfiForms_ 

#if($attachment.isEmpty()) worked for me.

Apart from this, I got below error too when I was not attaching any file:

Requested to https://jira.xxxxx.xxxxx.com/rest/api/latest/issue/xxxxxx/attachments has resulted in error. Response code = 415. Response contents:

This I managed to remove by checking on "Do not report error" checkbox.
Is it the right way to do it?

Alex Medved _ConfiForms_
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.
March 24, 2022

What content type do you set in the IFTTT that attempts to upload attachments?

Md Pervez Nawaz March 24, 2022

I don't see any content type in the IFTTT. Attaching a screenshot related to the attachment.

Untitled.jpg

Alex Medved _ConfiForms_
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.
March 25, 2022

Setting this to "do not report the error" does not fix the error

Attachment will not be uploaded

What do you have in the Request headers for the IFTTT that attempts to upload the file?

Screenshot 2022-03-25 at 09.32.51.png

What is the HTTP method parameter?

Alex 

Md Pervez Nawaz March 25, 2022

@Alex Medved _ConfiForms_ The error was coming only when I am not attaching anything. If I am attaching a file, this error is not coming.

For request header - Earlier it was the same as the above screenshot: "X-Atlassian-Token: no-check;"

But I have removed it now, thinking this was causing the error. But nothing changed after removing this as well.

Alex Medved _ConfiForms_
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.
March 25, 2022

Was confused by your earlier comments, I thought you were still struggling to upload an attachment

So, you need to make the IFTTT conditional

Checking if the attachment is present, before attempting to upload it

!fuDesc:[empty]

Assuming the field is named "fuDesc" in your form 

Like Md Pervez Nawaz likes this
Md Pervez Nawaz March 25, 2022

@Alex Medved _ConfiForms_ - You are Amazing!!! :)
Thanks a lot, it's perfect now!

Alex Medved _ConfiForms_
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.
March 25, 2022

Glad to hear that

Accept the solution ;)

Like Md Pervez Nawaz likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events