How to set value of dropdown based on another field?

How to set value of dropdown based on another field?

Hello,

I'd like to set the value of a dropdown when I can determine certain formats in a string field. Specifically, I am entering shipment tracking numbers and I want to set the associated carrier based on the string's format. The best example is probably UPS because their tracking numbers usually begin with "1Z".

This is my first Deluge script so I'm probably way off. It has no syntax errors but it doesn't do anything. The workflow I setup is "on update" and states that it will be executed as the field (Tracking Number) is being updated.

  1. if(input.Tracking_Number.startsWithIgnoreCase("1Z") == true)
  2. {
  3.     input.Carrier = "UPS";
  4. }

I'm fairly confident that one of my mistakes is on line 3. I'm setting a string here and Carrier is a dropdown. I just don't know how to set the dropdown.