You need to sign in to do that
Don't have an account?
Mario C
custom settings vlookup
Hi All,
I need to write a trigger on contact which will update the phone number when the the country code is not included in the number.
I thought that I could achieve this through Custom settings. I've got a custom settings call Country_letter_codes__c already setup. it includes 3 fields:
Country__c (name of the country in full)
Letter_Code__c (ISO code for each country - i.e. United Kingdom = GB)
Phone_Code__c (I've added this for my task and I populated it with all the corresponding phone codes i.e. Country__c = United Kingdom, Phone_code__c = +44...)
This cs is currently used to update the MailingCountry with a corresponding Letter_Code (i.e. from United Kingdom to GB), but I thought about using it for updating the contact phone too, and that is why I added a new field for Phone_Code__c.
Considering that I actually know how to write the code to update the number itself, I actually need to understand how to run a sort of vertical lookup on Letter_Code. Basically I need to find the contact MailingCountry (which is actually a letter_code) in the cs.letter_code and fetch the corresponding phone code, so that I can then append it to he phone number wher required.
I need to write a trigger on contact which will update the phone number when the the country code is not included in the number.
I thought that I could achieve this through Custom settings. I've got a custom settings call Country_letter_codes__c already setup. it includes 3 fields:
Country__c (name of the country in full)
Letter_Code__c (ISO code for each country - i.e. United Kingdom = GB)
Phone_Code__c (I've added this for my task and I populated it with all the corresponding phone codes i.e. Country__c = United Kingdom, Phone_code__c = +44...)
This cs is currently used to update the MailingCountry with a corresponding Letter_Code (i.e. from United Kingdom to GB), but I thought about using it for updating the contact phone too, and that is why I added a new field for Phone_Code__c.
Considering that I actually know how to write the code to update the number itself, I actually need to understand how to run a sort of vertical lookup on Letter_Code. Basically I need to find the contact MailingCountry (which is actually a letter_code) in the cs.letter_code and fetch the corresponding phone code, so that I can then append it to he phone number wher required.
All Answers
I eventualkly used the following:
I am now creating the test class but I only get 86% coverage with the following: The code coverage do not cover this line: and this line:
I'd like to get to 100% code coverage if possibile; can you help me?