Resources for IT Professionals >
Dynamics Forums
>
CRM
>
CRM 4.0 - Customize Address (City) field format
CRM 4.0 - Customize Address (City) field format
I want to have the City field automatically format (in the Contact and Business entities) to capitalize the first character.
(i.e. user enters 'scottsdale', system formats 'Scottsdale').Any ideas?
Answers
- Hi,
Go to "Settings" / "Customization" / "Customize entities" and open the entity you would like to add the attribute to (e.g. Contact in your case). Open "Forms and views" and "Form". On the customization form of the Contact entity, click the City field and go to "Events" tab. Add the OnChange event with the following script (provided that you refer to the "Address 1: City" field when talking about "City". If not, replace the field name):
I hope that helps,var oldCity = crmForm.all.address1_city.DataValue; var newCity = oldCity.substring(0,1).toUpperCase() + oldCity.substring.(1,oldCity.length); crmForm.all.address1_city.DataValue = newCity;
Kuba
-- Kuba Skałbania, Netwise- Proposed As Answer byKuba Skalbania Thursday, October 01, 2009 9:00 PM
- Marked As Answer byDonna EdwardsMVP, ModeratorFriday, October 02, 2009 7:42 PM
- Thanks to the Stunnware blog (http://stunnware.com/crm2/topic.aspx?id=JS4) we know how to make a string all capitalcrmForm.all.<name of text field>.DataValue = crmForm.all.<name of text field>.DataValue.toUpperCase();Then we have this from Stack Overflowwhich is a jscript function for converting to proper form.Hope it helps.Leon TribeWant to hear me talk about all things CRM? Check out my blogor hear me tweet @leontribe
Want to hear me talk about all things CRM? Check out my blog http://leontribe.blogspot.com/ or hear me tweet @leontribe- Proposed As Answer byLeon TribeMVPThursday, October 01, 2009 9:00 PM
- Marked As Answer byDonna EdwardsMVP, ModeratorFriday, October 02, 2009 7:42 PM
All Replies
- Hi,
Go to "Settings" / "Customization" / "Customize entities" and open the entity you would like to add the attribute to (e.g. Contact in your case). Open "Forms and views" and "Form". On the customization form of the Contact entity, click the City field and go to "Events" tab. Add the OnChange event with the following script (provided that you refer to the "Address 1: City" field when talking about "City". If not, replace the field name):
I hope that helps,var oldCity = crmForm.all.address1_city.DataValue; var newCity = oldCity.substring(0,1).toUpperCase() + oldCity.substring.(1,oldCity.length); crmForm.all.address1_city.DataValue = newCity;
Kuba
-- Kuba Skałbania, Netwise- Proposed As Answer byKuba Skalbania Thursday, October 01, 2009 9:00 PM
- Marked As Answer byDonna EdwardsMVP, ModeratorFriday, October 02, 2009 7:42 PM
- Thanks to the Stunnware blog (http://stunnware.com/crm2/topic.aspx?id=JS4) we know how to make a string all capitalcrmForm.all.<name of text field>.DataValue = crmForm.all.<name of text field>.DataValue.toUpperCase();Then we have this from Stack Overflowwhich is a jscript function for converting to proper form.Hope it helps.Leon TribeWant to hear me talk about all things CRM? Check out my blogor hear me tweet @leontribe
Want to hear me talk about all things CRM? Check out my blog http://leontribe.blogspot.com/ or hear me tweet @leontribe- Proposed As Answer byLeon TribeMVPThursday, October 01, 2009 9:00 PM
- Marked As Answer byDonna EdwardsMVP, ModeratorFriday, October 02, 2009 7:42 PM
- Thank you for the posting. I tried out this script but keep getting errors. Any troubleshooting tips?

