Check State Value in Event

Bear with me. I’m learning Application Studio so sorry for any dumb questions, I have many :slight_smile:

I want to check the state field when they enter it to ensure that it is only two digits. We are on 2023 so I can’t use Pattern…sigh

I created an event, ColumnChangeing_State. Something I’m doing is not working right.

In the event-next I have the below JSON in the parameters

{
	"expression": {
		"left": {
			"path": "CustomerRow.State.Length"
		},
		"operator": "Equal",
		"right": {
			"value": 2
		}
	}
}

Then the error message handler has

I was so distrustful about users entering states correctly that I just made a state UDCode Type and then put all 50 abbreviations in as the ID and the full state name as the description and then use a combo box where they’re supposed to enter the state.

Even if you get this to work, most people go partially blind when an error message pops up, they can only see the ok/close button.

I was leaning that way, but we may ship out of the country. How do you handle that with the UD Codes?

Why not just set the text box to 2 characters so they can’t type more than that?

It’s a native control that is set at 50. I would need to check the data and see if there is anything in there over 2 characters. But it’s a thought I’ll look into.

We don’t ship out of the country so I didn’t have to tackle that issue. If the state field would be used in whatever country you’re shipping to you could just add those options to your ud code. So if you’re gonna ship to canada, just add all of the provinces and their abbreviations to the state UDCode.

There are these values in state. So that begs the question why are they limiting the state to two characters :thinking:
image

This, then, becomes a Process and Training issue. Saskatchewan is a Canadian Province, so it’s “SK” abbreviation would work. Puerto Rico is (at least for the US Postal Service) considered a state so it’s “PR” abbreviation would also work. @cory.davis’ UD codes does this admirably.

Dominican Republic, however, is a separate COUNTRY. If you have customers there and ship there, you should set up a Country record, and define how you want to use (or NOT use) the “state” field for those customers.

Hey Tammy, were you able to find a resolution to this? I am looking for the exact same solution.

I ended up creating a user codes for the drop-down state. When we upgrade to the next version, I’m going to revisit this.