Switch condition not working in workflow

Hari1
Mega Sage

Hi,

I have created a workflow using a switch block and the variable used inside the switch condition is a single line text. I see the switch block is stuck and does not move to the next block.

find_real_file.png

In the logs created through workflow see the typeof variable passed is object but when i log the variable single line text on the catalog it gives me as string. I am using activity.result == 'IN' in the switch conditions as per the regions.

find_real_file.png 

1 ACCEPTED SOLUTION

Hi Hemanth,

You cannot access workflow scratchpad inside switch activity

alternative here

Access Scratchpad from Switch Core Activity -Kingston

Regards
Ankur

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Saud Shaikh
Tera Contributor

I had a similar situation and I have been doing and redoing the workflows believing that I am missing something. What is more weird is, one condition in the switch would work all ok and the approval groups are attached correctly but for the other it just wouldn't work.

 

After many attempts trying to fix it, I gave up and tried multiple IF blocks as a workaround.

 

Edit: Yesterday after I posted the above comment, I sat down today again to figure out why a condition on the switch would work while the other would not. It just seemed weird to me. What I noticed is in the Run script before the switch, the value being set was different than what it should be. To be more precise, it was truncating the value from the end. Maybe it could accept only a certain length of value. So I shortened the value in my original select choice and then Voila! it worked like a charm. Still unsure about why it would not accept the previous value.

Do let me know if any one of you have faced such a situation and if you have any explanation to the same.

Hope this helps someone! 🙂   

Had the same issue! Apparently 40 characters is the limit. Anything above 40 doesn't run in the switch activity.