AnsweredAssumed Answered

"Semi" unique value; validation or prevention

Question asked by Cécile on Feb 10, 2019
Latest reply on Feb 17, 2019 by Cécile
ProductsPrices
UUIDID
PriceCode
isActive

Each given product can have various prices: regular, volume1, fallpromo, etc. Those are the price "name" or as the field is called, "PriceCode". When the user create a price, he gives it a name or can use one from the dropdown. (Drop down value list is from field).

duplicates.png

Each price code is "semi unique" in a sense that it must be unique for each product's prices found set (subset of all prices) but can be repeated across various products price sets.

 

How do I prevent a user to create two price lines with the same PriceCode for a given product?

1-Validation (how do I prevent the user from bypassing the warning, since I cannot check the "unique value" box?)

2-Script trigger (How do I restrain the validation to check the ProductCodes to only the prices of the current product?)

or

3-Preventing a string to appear in the dropdown if one of the price lines for that given product uses that code.

Outcomes