Question

How to attach a file from Google Forms in Jira in the right format?

  • 5 October 2022
  • 9 replies
  • 341 views

I’m using the action Add Attachment to Issue to transfer a Google Form image to a Jira issue and even though we can see an attachment, it appears in an html format.

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

9 replies

Userlevel 7
Badge +9

Hey there, @danielaelforzoli!

Thanks for reaching out in the community! Sorry to hear you’re running into this. 😔

Are you able to share a screenshot of your Gmail and Jira zap setup, with any personal details removed? That may help us troubleshoot more with you.

Thanks so much and looking forward to digging into this with you!

Userlevel 6
Badge +8

Hey there @danielaelforzoli!

Unfortunately, Google Forms doesn’t send a direct download link to uploaded files, which is what Jira needs to recognize and implement the file. Getting the direct download link will take an additional step in your Zap, and a few additional setup steps outside of your Zap.

First, add a Code by Zapier action just before the Jira step. This code will parse the link created by Google Forms and place it into a direct download link. Select Javascript, and then in the action setup, write “ScreenshotLink” in the left box of Input Data and place the link (“Any Screenshot...file to attach?” from your first screenshot above) in the right field. The paste the following code in the code area (be sure to overwrite any default code that gets added). I’ve also included a screenshot so you can see exactly what this looks like.

var id = inputData.ScreenshotLink.split("id=")[1];

var downloadLink = "https://drive.google.com/uc?id=" + id + "&export=download";

output = [{downloadLink}];

Then be sure the download link output by this step is what you include as the attachment in the Jira step.

The Zap is ready, but before the Zap can function, you will also need to make these downloads publicly accessible to anyone with the link.

In Google Forms, click on the “Responses” tab. Navigate to the screenshot submissions and click on “View Folder” (as in the screenshot below). Once you’re in the Google Folder, click on the file’s name, and then on “Share”. In the popup window, be sure to share with “Anyone with the Link”.

 

 

Please let me know if this all works out for you or if you run into any other snags along the way!

Userlevel 6
Badge +8

@danielaelforzoli Thanks for your thorough explanation!

No, the “Find Issue” action is only necessary if you don’t already have the project key. Getting it from the “Create Issue” action is just fine :)

From your screenshots, it really seems like you’re doing everything right and I can’t see why the attachment isn’t coming through as a .png file!

The one thing I’m wondering...if you click on “View Folder” in your Google Forms responses, right click on the image, and copy the link, can you open it in an incognito / private browser window? If not, there’s still a problem with your sharing, and that is likely our culprit.

Hi Todd, 

Thank you for the video. Indeed, there are other actions in the zap after triggering the New Form Response in Google Forms (as you can see attached). I needed to transform some important information of the form with a Lookup Table in order that the right fields were recognized in the new created Jira issue. 

 

I did not add a Find Issue action after the JS code (I don’t know if this might be the problem). After the Jira issue is created, the code you recommended is executed (see attached) and then the attachment is added in the previously created issue. 

 

 

This is what happen on Jira side, the issue is well created and then an attachement is added but not as a proper image. This is the image I attached on the form response: 

 

 

And this is what is attached from the zap into the Jira issue: 

 

Hi Christina, 

 

Thank you for taking the time to review this. I’m sharing the set up of the action plus the result I see after testing it. We see that the mymeType is text/html, I can presume this is the reason why the attachment that is appearing in the Jira issue is not an image. 

 

Hello @Todd Harper 

 

Thank you so much for all the details in your answer. I followed all the steps you mentioned, running the JS code in the zap and giving access to everyone with the link to the Google Folder, but the file is unfortunately still been attached as a text in the Jira issue 😥

Userlevel 6
Badge +8

@danielaelforzoli 

Since you didn’t explicitly mention it above, can you confirm that you also updated your Jira step so that the attachment link referenced is from the code step and not the Google Form trigger?

Yes! Confirming I used the output Download Link from the code previous step in the attachment.  

 

Userlevel 6
Badge +8

@danielaelforzoli Hmm...not sure what’s going on with that, then. I just gave it a test run and it all worked just fine for me. See my recording below. Give it a quick watch and maybe we can figure out why it’s working for me and not for you.