How to update values on Jira based on the selection from ConfiForm (Web Service Request)?
Asked by Md Pervez Nawaz:

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\]")

<br />

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


Answers:
author: Alex Medved _ConfiForms_
body: 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

comments: author: Md Pervez Nawaz
body: Thanks [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)   

#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?


author: Alex Medved _ConfiForms_
body: What content type do you set in the IFTTT that attempts to upload attachments?


author: Md Pervez Nawaz
body: I don't see any content type in the IFTTT. Attaching a screenshot related to the attachment.

![Untitled.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/189941iA83349518049A834/image-size/large?v=v2&px=999 "Untitled.jpg")


author: Alex Medved _ConfiForms_
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/189943i7EE56DEA220CB933/image-dimensions/300x186?v=v2 "Screenshot 2022-03-25 at 09.32.51.png")

What is the HTTP method parameter?

Alex


author: Md Pervez Nawaz
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) 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.


author: Alex Medved _ConfiForms_
body: 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


author: Md Pervez Nawaz
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) - You are Amazing!!! :)  
Thanks a lot, it's perfect now!


author: Alex Medved _ConfiForms_
body: Glad to hear that

Accept the solution ;)


Tags: cloud

confiforms

confluence-cloud

jira

webservice