I have a zoo__c
object. On Zoo__c
, I have a field called firstName__c
. I want to prevent insertion/updating of records if firstName__c
has any of these characters at the end - "op" , "gp" , "kp"
. If any of these characters are at the end of the firstName__c
value then ignore them and do not insert. What is the best way to achieve this. I have a lot of zoo__c records in xls sheet which I will be uploading using Dataloader. I do not have option to remove the records that are not needed before inserting them.
What I think:
a. I thought, I can write a Validation rule to prevent the insertion of the record whose name ends with "op" , "gp" , "kp"
but I do not see a formula which can check only the last two characters of a text in formula.
b. Should I go with a trigger and check in before insert using string methods. Throw an error if the last two characters match with the text.
Any suggestions on the options for this?