hello, I have the following problem in my Switch activity, always enters the default case, how can I solve it?

Inkedcaptura 1_LI

Inkedcaptura 2_LI

Hi @Atejera,

You do not need to specify item = ABC or item = “ABC”

Just write Name string without quotes for example.

Start switch,
Condition = Item

Case 1. ABC
Case 2. BCD
Case 3. CDE

That’s it. Remember case string is without quotes.

What the switch does is that it first saves Item variable and checks each Case if the Item variable is a match and takes the first possible route which satisfies the condition.

I worked perfectly, thank you very much!!! the only problem now, is that every time it runs it sends me mails, as if I were going into all the cases of the switch.



Hi @Atejera, Can you take a screenshot of just above the switch. Also try logging Item variable before it goes into the switch, may be the variable is not updated for each row or array. I cant see what you are using to iterate.



top edit and attach more screenshots too!

Yup you are looping through an array. I would try and print item just before the switch and check. Because you switch now is correctly set. It should be the item variable or it can also be the SendOutlookMail activity was copied from your case to other cases and the input to SendOutlookMail was set to your name?

The two possibilities I can think of.



item changes correctly from what I see.

So we know item is not the culprit. Can you check inputs to your SendOutlookMail activity if it takes in “item” as input as well for each case.

I am trying to debug without access to Studio sorry. What is confusing me is the the loop has the correct item, your swtich takes in string as condition right? (properties panel of switch) but the emails are being sent only to you.

1 Like

Another simple debugging step will be to put the Log Message as Item in each of the case and run the bot (you can comment out the send outlook mail activity in each of the activity that way no emails are send when you are debugging)

Ideally, the item in each case should be logged properly.

1 Like

Thank you very much, I could solve it! It was a problem with the variable isBirthday which was always True and made everything run. Adding an Assignment activity after the IF solves this problem.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.