{"id":256,"date":"2022-01-12T14:56:23","date_gmt":"2022-01-12T14:56:23","guid":{"rendered":"https:\/\/blog.citrus-lime.com\/crmc\/?p=256"},"modified":"2022-01-12T14:56:24","modified_gmt":"2022-01-12T14:56:24","slug":"uk-formatting-for-address-composites-in-crm-2015","status":"publish","type":"post","link":"https:\/\/blog.citrus-lime.com\/crmc\/uk-formatting-for-address-composites-in-crm-2015\/","title":{"rendered":"UK Formatting for Address Composites in CRM 2015"},"content":{"rendered":"\n<p>CRM 2015 introduces the ability to edit a Company or Contact Address via a single Memo field, allowing a single break-down of fields instead of viewing each line of the address individually.<\/p>\n\n\n\n<p>So we have:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image5_1551EF98.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image5_thumb_14E5BCA3.png\" alt=\"image5\" title=\"image5\" \/><\/a><\/figure>\n\n\n\n<p>Instead of:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image2_498618DE.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image2_thumb_53D73D3E.png\" alt=\"image2\" title=\"image2\" \/><\/a><\/figure>\n\n\n\n<p>However many clients of CRM prefer a fixed UK-format for an Address, as opposed to the \u2018State\/Province\u2019 or \u2018ZIP\/Postal Code\u2019 terminology, so how can we vary how the fields in this address box appear?<\/p>\n\n\n\n<p>There is no out of the box method of customising the fields once they are part of the Address Memo field, which gives us a problem.&nbsp;<\/p>\n\n\n\n<p>However, by the introduction of a piece of Javascript we can work around this problem.<\/p>\n\n\n\n<p>If we add a block of script onto the Form and then run this script onLoad, we can change the Label used for the Address pop-up:<\/p>\n\n\n\n<p><strong>function setAddressCompositeToUKFormat() {<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Xrm.Page.getControl(&#8220;address1_composite_compositionLinkControl_address1_line1&#8221;).setLabel(&#8220;Street 1&#8221;);<\/strong><\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Xrm.Page.getControl(&#8220;address1_composite_compositionLinkControl_address1_line2&#8221;).setLabel(&#8220;Street 2&#8221;);<\/strong><\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Xrm.Page.getControl(&#8220;address1_composite_compositionLinkControl_address1_line3&#8221;).setLabel(&#8220;Street 3&#8221;);<\/strong><\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Xrm.Page.getControl(&#8220;address1_composite_compositionLinkControl_address1_stateorprovince&#8221;).setLabel(&#8220;County&#8221;);<\/strong><\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Xrm.Page.getControl(&#8220;address1_composite_compositionLinkControl_address1_postalcode&#8221;).setLabel(&#8220;Postcode&#8221;);<\/strong><\/p><\/blockquote>\n\n\n\n<p><strong>}<\/strong><\/p>\n\n\n\n<p>Once done \u2013 we can see the pop-up composite in our revised format:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image8_1DC614EB.png\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image8_thumb_3D74EEB3.png\" alt=\"image8\" title=\"image8\" \/><\/a><\/figure>\n\n\n\n<p>This is not a perfect solution, as this block of Javascript then needs to be applied to each applicable Form within our solution (typically Account, Contact and Lead) but otherwise gives a simple solution to use the Address Composite functionality without immediately appearing in US-Format which can be off-putting for some users \u2013 and thankfully the introduction of Web Resources in CRM 2011 gives us a method of using a common Web Resource applied to each form to avoid too much copy and paste code.<\/p>\n\n\n\n<p>For more information, the following links may be useful:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.magnetismsolutions.com\/blog\/paulnieuwelaar\/2013\/10\/22\/working-with-dynamics-crm-2013-composite-fields-fly-out-menu\">https:\/\/www.magnetismsolutions.com\/blog\/paulnieuwelaar\/2013\/10\/22\/working-with-dynamics-crm-2013-composite-fields-fly-out-menu<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>CRM 2015 introduces the ability to edit a Company or Contact Address via a single Memo field, allowing a single break-down of fields instead of viewing each line of the address individually. So we have: Instead of: However many clients of CRM prefer a fixed UK-format for an Address, as opposed to the \u2018State\/Province\u2019 or<\/p>\n","protected":false},"author":43,"featured_media":35,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[3],"tags":[],"class_list":{"0":"post-256","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-crm"},"featured_image_src":"https:\/\/blog.citrus-lime.com\/crmc\/wp-content\/uploads\/sites\/30\/2021\/11\/Dynamics-365-Consultancy.jpg","author_info":{"display_name":"jadesmith","author_link":"https:\/\/blog.citrus-lime.com\/crmc\/author\/jadesmith\/"},"_links":{"self":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/comments?post=256"}],"version-history":[{"count":1,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":258,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/256\/revisions\/258"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media\/35"}],"wp:attachment":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}