You need to sign in to do that
Don't have an account?
Newbie10
Profanity check
I have a multiselect picklist in my grandparent object.
I have a text field in my object.
Whenever user enters text into this text field ,and after saving i need to check whether my text contains the values defined in picklist
This is mainly for a profanity check .
what is the best way to do this?
Do like this
trigger ProfanityCheck on Object__c(after insert,after update){
Set<String> pkVals = new List<Set>();
for(Object__c obj : Trigger.new){
String selObj = 'Object__c';
Schema.DescribeFieldResult pkField = selObj.getDescribe().fields.getMap().get(obj.FatherParent__r.GrandParent__r.PicklistField__c).getDescribe();
List<Schema.PicklistEntry> pkValues = urlParamType .getPicklistValues();
for(Schema.PicklistEntry p : pkValues ){
pkVals.add(p.getValue());
}
if(pkVals.contains(p.TextField__c)){
//Write what you want to do if that condition satisfies
}
}
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Regards,
Satish Kumar
A multipicklist where values are defined
and a text fields where i need to check whether any of the content contains any of these values in picklist
The values are case sensitive i believe.
If there are a lot of values in the picklist, its best to use a trigger as one of our members suggested.
Hope this helps.
Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.