Make a field unique based on another field in a table

I want to change a table so that descriptions don’t need to be unique in the table, but they do need to be unique specific to an id number field. For example if the ID represented a hotel.

You could have more than one room 1 in the table, but you couldn’t have more than one room 1 with the same id number.

I’ve tried to do this through indexing but it doesn’t seem to prevent this from happening, Will I need to use X++ validation to do this?

Have you tried by having an unique index on Hotel Id and Room Id combination?

Yeah it’s working now. I had that setup already and thought it wasn’t working but it turns out the AOT just wasn’t syncing to the database for some reason so the index hadn’t become active. Thanks.