Best answer

Help utilizing info from "Find User in Asana" action, specifically when no user match is found

  • 19 January 2023
  • 3 replies
  • 124 views

Userlevel 1

Hi there!

I’ve built a Zap that takes Typeform responses as a trigger and then, based on the content of the responses, creates Asana tasks with different descriptions, assignees, due dates, followers/collaborators, etc. One piece of this that I’m getting stuck on, though, has to do with the “Find User in Asana” action in Zapier.

I’m going to spell out a lot of written detail here, but feel free to skip to the end of this post to see the TL;DR version of my question.

Background/Context:

In the aforementioned Typeform, we have users enter their email address. Immediately after the Typeform trigger in our Zap, we’re using the “Find User in Asana” action so we can use that info to automatically add the person who submitted the Typeform as a follower/collaborator on the Asana task when it’s created. I have “Should this step be considered a ‘success’ when nothing is found?” set to “Yes/true” so that the rest of the Zap will continue even if a user match isn’t found.

However, because we’re using the data from the “Find User in Asana” step to automatically add any match as a follower/collaborator to an Asana task - if no match is found in the “Find User in Asana” action, that step returns an error message (The app returned `{"message":"user: Not a recognized ID: example@example.com) and then the subsequent Asana task creation steps are skipped entirely.

  • My first attempt at resolving this was building different paths - one for if an Asana ID exists after the “Find User in Asana” action (in which case it should proceed to generate the Asana task with the submitter added as a follower/collaborator), and another for if an Asana ID doesn’t exist (in which case it should create the task, but not attempt to add the person as a follower/collaborator). This attempt didn’t work either, for similar reasons - because it seems that when the “Find User in Asana” action fails to find a match, it will skip any step or path that wants to use any of its information for branching or task execution.

 

  • My other attempt was trying a very similar idea, but instead using the “Zap Search Was Found” property of the “Find User in Asana” action to control the branching - one path for “true” and another for “false”. I thought this approach might work due to the earlier settings I mentioned (specifically, the “Should this step be considered a ‘success’ when nothing is found?” being set to “Yes/true”) and because the instructions listed next to that particular setting in Zapier say “If true, we will consider a ‘not found’ result from this search step as a "success" and will always run subsequent Filter or Paths steps, allowing them to branch on whether or not the search returned a result.” I still ran into the same result, though - neither path ran because they were trying to use info from the “Find User in Asana” action/step that failed to find a matching user.

Summary/TL;DR:

So with all of those details outlined, here’s a shortened version of my question: When using the “Find User in Asana” action, how can I set up subsequent paths/branches of the Zap to run specifically when the “Find User in Asana” action fails to find a match? I want to run one path if there is a match, and a different path if there isn’t. Is that even possible, or did I misunderstand something?

I should clarify here that these Zaps work as intended when a user is found in Asana - it’s just when no match is found that I’m having issues.

I have some other ideas I’m happy to outline, too, but I wanted to see if I get any responses here first. I’m moderately experienced with Zapier but definitely not a power user, so I’m hoping there’s a simple way to achieve this that I’m just overlooking.

Thank you in advance for any help or suggestions you can provide!

icon

Best answer by Troy Tessalone 19 January 2023, 04:27

View original

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

3 replies

Userlevel 7
Badge +14

Hi @Colinfm88 

Good question.

I was able to replicate your issue, which seems to be a bug.

You should report this via a ticket to Zapier Support: https://zapier.com/app/get-help

 

Give me a bit and I’ll get you a workaround.

Userlevel 7
Badge +14

@Colinfm88

You can use a Code to make an app API request and handle the response.

 

Asana API endpoint: https://developers.asana.com/docs/get-a-user

Asana API Key: https://developers.asana.com/docs/personal-access-token

 

 

 

let API_KEY = inputData.API_KEY;
let EMAIL = inputData.EMAIL;

let response = await fetch(`https://app.asana.com/api/1.0/users/${EMAIL}`, {
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Accept': 'application/json'
}
});

let result = "";
let match = "";
if (!response.ok) {
result = "ERROR: NOT FOUND";
match = false;
}
if (response.ok) {
result = await response.json();
match = true;
}

output = [{EMAIL, API_KEY, match, result}];

 

RESULTS
You can use the match variable in the Path Filters.

 

OR

 

Userlevel 1

Thank you so much, Troy! I really appreciate your help with this.

I will go ahead and report my issue to Zapier support, and then dig into this Code workaround to call the Asana API in the meantime.

Thanks again for this! Super helpful and appreciated. I’ll report back here ASAP with my results.