We are working on a solution for attaching social media image files to new Asana tasks. Some of those tasks have several images, to be posted together. The Zap we have build so far extracts the first four characters from the file names (‘S00X') and whenever there are files that are named as ‘S00X-01’, 'S00X-02’, it attaches them to the same task.
Here’s a screenshot of how the Zap works now:
File is added to the G Drive folder
Truncate the first 4 digits of its name = truncName
‘Delay after queue', so that zap waits for the previous file to be processed before starting with the next one. They have to be executed consecutively, otherwise it doesn’t find the tasks with the same name and creates duplicates.
Find task in Asana with the title truncName. If no such task, create the task truncName and attach the file to it
If truncName Asana task exists, add the file to it.
However, the problem is that whenever we need to replace some of the attachments that come after client feedback, we have to manually delete them from both Google Drive folder and the Asana task, then drop into the folder again for them to be attached.
Instead, we would like to improve this Zap to do the following:
When the image file is added to the Google folder, look up the task that has name as truncName and check if it already has the attachment with the same name as the file just added.
If the attachment with the same name exists, remove it and attach this new file instead.
Since there is only a ready-made option to ‘add attachments’ but no way to remove them, we’ve found suggestions to use Web hooks and Code by Zapier to retrieve the attachments and delete them, however I have no experience of writing API calls or coding, and therefore wanted to reach out for your help first.
Thank you!
Page 1 / 1
Hi @pilotinstitute
Try creating a “Custom Action” for Asana with the help of AI.
It looks like the specific endpoints you’d need to use are Asana’s Get attachments from an object (for finding the attachment) and the Delete an attachment (to remove it) endpoints. Troy is correct, we’ve got a AI Builder feature that can help you to create custom actions for Asana to find and replace attachments. You can learn more about using the AI Builder here: Create a Custom Action > Create with AI Builder
In the meantime it would be great if you could also reach out to our Support team to submit a new feature request to have Find Attachment and Remove Attachment actions added to the Asana app on Zapier! You can do that here: https://zapier.com/app/get-help. This will allow us to track interest in having those actions so they can be added in the future.
Hope all goes well with setting up those Custom Actions and if you run into any trouble at all, please do let us know - always happy to assist further!
240527 ticket response text: problem with retrieving the filename
Thank you both for your responses - it is very helpful. Based on these. I have now gone ahead and generated two custom actions:
Get attachments for the Asana task. This action picks up the task ID from step 2 and returns the attachments as an array of IDs and filenames: [{"gid":"1207413011329099","name":"S999-1.jpg"},{"gid":"1207413011329101","name":"S999-2.jpg"}]
Delete an Attachment. This action requires the GID found by previous action and deletes the attachment.
Here’s a screenshot for the Get Attachments Action:
My problem is now how to combine those two steps. I suppose that here I need another action that would go through the array above, compare it to the full filename of the file just added, and if the two names match, it would return the GID for that specific file.
With these results, if GID is returned, delete the file. If not, skip the Delete step and proceed to Attach (step 5)
So overall, the updated Zap could look like this (new steps in red):
File fullName is added to the G Drive folder.
Truncate the first 4 digits of fullName = truncName.
‘Delay after queue', so that Zap waits for the previous file to be processed before starting with the next one. They have to be executed consecutively, otherwise it doesn’t find the tasks with the same name and creates duplicates.
Find a task in Asana with the title truncName. If no such task, create the task truncName.
Get the list of attachments for task truncName. (Custom Action is tested and working)
Verify if the file fullName is present in the list of attachments. If exists, return its GID, if not, return False.
If GID exists, delete the attachment, if not, skip this step. (Custom Action is tested and working + Zapier Path to split the if/else condition)
Attach the file fullName to truncName Asana task.
Thus, my main question is about step 6. But also let me know if you have any overall suggestions for steps 5-7. Very much appreciate your help!
Sorry for the delay in a reply here @pilotinstitute. Fantastic work on this so far!
For step 6 you’d want to have a Paths by Zapier action to check the field that contains the list of attachments contains the same filename as the file that triggered the Zap. That would allow you to have two paths to run different actions depending on whether or not the filename was found to be a match.
So what’s listed as step 7 and step 8 would be the relevant actions inside the two paths to either delete or attach the file in Asana as necessary. For example:
6 - Paths by Zapier
7 - Path A - Only continue if the Array field (Text) Contains the Filename mapped from Google Drive trigger (step 1)
Delete attachmentCustom Action (Asana) deletes the attachment.
8 - Path B - only continue if the Array field (Text) Does not contains the Filename mapped from Google Drive trigger (step 1)
Attach File(Asana) attaches the attachment to the relevant task.
Does that sound like it would work for your needs here?
thank you very much @SamB and apologies also for the late reply - let me evaluate and test out this option, and get back here!
No worries, @pilotinstitute! I look forward to hearing how it goes.