You need to sign in to do that
Don't have an account?
trailhead solutions 10
Trigger on PhoneNum - Not Working
Hello
My Requirement is to, whenever there is Phone Number entered in case Object, then in that case, if User enters any Special Characters, then it should ignore the Special Characters and display only the Digits.
I wrote a Trigger on it. Seems to be Correct. But, not working while I am testing.Please someone test in your Org and let me know, where I did mistake.
trigger PhNumValidation on Case (before insert,before update) {
list<case> clist=new list<case>();
for(Case c:Trigger.new){
if (c.Phone_Number__c != null ) {
string phone =c.Phone_Number__c;
string newph=phone.replaceAll('\\D','');
system.debug('Ph: '+newph);
}
}
}
Thanks
GSN
My Requirement is to, whenever there is Phone Number entered in case Object, then in that case, if User enters any Special Characters, then it should ignore the Special Characters and display only the Digits.
I wrote a Trigger on it. Seems to be Correct. But, not working while I am testing.Please someone test in your Org and let me know, where I did mistake.
trigger PhNumValidation on Case (before insert,before update) {
list<case> clist=new list<case>();
for(Case c:Trigger.new){
if (c.Phone_Number__c != null ) {
string phone =c.Phone_Number__c;
string newph=phone.replaceAll('\\D','');
system.debug('Ph: '+newph);
}
}
}
Thanks
GSN
Please try the below code:
Assign the Value to c.Phone_Number__c... It's missing in your code so it's not working...
Thanks,
Maharajan.C
All Answers
Please try the below code:
Assign the Value to c.Phone_Number__c... It's missing in your code so it's not working...
Thanks,
Maharajan.C
Thanks a ton Maharajan..