{"id":20,"date":"2013-07-15T05:34:00","date_gmt":"2013-07-15T00:04:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=20"},"modified":"2013-07-15T05:34:00","modified_gmt":"2013-07-15T00:04:00","slug":"check-attribute-typeformats-in-crm-2011-javascript","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2013\/07\/check-attribute-typeformats-in-crm-2011-javascript\/","title":{"rendered":"Check attribute type\/formats in CRM 2011 javascript."},"content":{"rendered":"<div dir=\"ltr\" trbidi=\"on\"><!--[if !mso]>\n\n<style>v\\:* {behavior:url(#default#VML);} o\\:* {behavior:url(#default#VML);} w\\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} <\/style>\n\n<![endif]--><br \/><!--[if gte mso 9]><xml> <w:WordDocument>  <w:View>Normal<\/w:View>  <w:Zoom>0<\/w:Zoom>  <w:TrackMoves>false<\/w:TrackMoves>  <w:TrackFormatting\/>  <w:PunctuationKerning\/>  <w:ValidateAgainstSchemas\/>  <w:SaveIfXMLInvalid>false<\/w:SaveIfXMLInvalid>  <w:IgnoreMixedContent>false<\/w:IgnoreMixedContent>  <w:AlwaysShowPlaceholderText>false<\/w:AlwaysShowPlaceholderText>  <w:DoNotPromoteQF\/>  <w:LidThemeOther>EN-US<\/w:LidThemeOther>  <w:LidThemeAsian>X-NONE<\/w:LidThemeAsian>  <w:LidThemeComplexScript>X-NONE<\/w:LidThemeComplexScript>  <w:Compatibility>   <w:BreakWrappedTables\/>   <w:SnapToGridInCell\/>   <w:WrapTextWithPunct\/>   <w:UseAsianBreakRules\/>   <w:DontGrowAutofit\/>   <w:SplitPgBreakAndParaMark\/>   <w:DontVertAlignCellWithSp\/>   <w:DontBreakConstrainedForcedTables\/>   <w:DontVertAlignInTxbx\/>   <w:Word11KerningPairs\/>   <w:CachedColBalance\/>  <\/w:Compatibility>  <m:mathPr>   <m:mathFont m:val=\"Cambria Math\"\/>   <m:brkBin m:val=\"before\"\/>   <m:brkBinSub m:val=\"--\"\/>   <m:smallFrac m:val=\"off\"\/>   <m:dispDef\/>   <m:lMargin m:val=\"0\"\/>   <m:rMargin m:val=\"0\"\/>   <m:defJc m:val=\"centerGroup\"\/>   <m:wrapIndent m:val=\"1440\"\/>   <m:intLim m:val=\"subSup\"\/>   <m:naryLim m:val=\"undOvr\"\/>  <\/m:mathPr><\/w:WordDocument><\/xml><![endif]--><span><span><span><\/span>Now we can check the attribute formats in CRM java script.<\/span><\/span> <\/p>\n<div><\/div>\n<div><span><span>To do this you just need to use the function \u201cgetFormat\u201d. This function returns a string value that represents formatting options for the attribute. You can refer the below code to check the format of different types of attributes.<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span><span>function<\/span>GetFormatOfAttributes() {<\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0 <span>var<\/span> attributeFormat;<\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0 <span>try<\/span> {<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of String<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;name&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;The format of name is &#8220;<\/span> + attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/4.bp.blogspot.com\/-zbScm4x3Y_o\/UeOF8gsfOSI\/AAAAAAAAB_E\/W7mKKufia2U\/s1600\/1.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/4.bp.blogspot.com\/-zbScm4x3Y_o\/UeOF8gsfOSI\/AAAAAAAAB_E\/W7mKKufia2U\/s1600\/1.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span><\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of Email attribute<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;emailaddress1&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0alert(<span>&#8220;The format of emailaddress1 is &#8220;<\/span> + attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/3.bp.blogspot.com\/-zCJMSJdghDE\/UeOGKNui--I\/AAAAAAAAB_M\/EoWJ5rmb-h0\/s1600\/2.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/3.bp.blogspot.com\/-zCJMSJdghDE\/UeOGKNui--I\/AAAAAAAAB_M\/EoWJ5rmb-h0\/s1600\/2.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of the Date and Time attribute<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;createdon&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;The format of createdon is &#8220;<\/span>+ attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/2.bp.blogspot.com\/-bjhPSyJMSpU\/UeOGZfqjGhI\/AAAAAAAAB_U\/HaYoxkRcIZY\/s1600\/3.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/2.bp.blogspot.com\/-bjhPSyJMSpU\/UeOGZfqjGhI\/AAAAAAAAB_U\/HaYoxkRcIZY\/s1600\/3.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of Duration<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;new_duration&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;The format of Duration is &#8220;<\/span>+ attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/3.bp.blogspot.com\/-7ptCmRx0cLk\/UeOGn_6F9EI\/AAAAAAAAB_c\/tFPVTo7pbIo\/s1600\/4.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/3.bp.blogspot.com\/-7ptCmRx0cLk\/UeOGn_6F9EI\/AAAAAAAAB_c\/tFPVTo7pbIo\/s1600\/4.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span><\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of Date Only<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;new_date&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0alert(<span>&#8220;The format of new_date is &#8220;<\/span> + attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/2.bp.blogspot.com\/-3-KaDSf8j84\/UeOGuRAIuOI\/AAAAAAAAB_k\/MCaEjoq1Ylo\/s1600\/5.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/2.bp.blogspot.com\/-3-KaDSf8j84\/UeOGuRAIuOI\/AAAAAAAAB_k\/MCaEjoq1Ylo\/s1600\/5.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span><\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of Time Zone<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;address1_utcoffset&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;The format of address1_utcoffset is &#8220;<\/span> + attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/4.bp.blogspot.com\/-ATJ8aseaMdI\/UeOG1uFS9kI\/AAAAAAAAB_s\/MIoMIar_nWg\/s1600\/6.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/4.bp.blogspot.com\/-ATJ8aseaMdI\/UeOG1uFS9kI\/AAAAAAAAB_s\/MIoMIar_nWg\/s1600\/6.jpg\" height=\"148\" width=\"320\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span><\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span>\/\/Get the format of Url<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;websiteurl&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;The format of websiteurl is &#8220;<\/span>+ attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/3.bp.blogspot.com\/-iMza8mOuwiA\/UeOHDo353OI\/AAAAAAAAB_0\/Pwh6Wp_J3kM\/s1600\/7.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/3.bp.blogspot.com\/-iMza8mOuwiA\/UeOHDo353OI\/AAAAAAAAB_0\/Pwh6Wp_J3kM\/s1600\/7.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span>\/\/Get the format of multi line text<\/span><\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 attributeFormat = Xrm.Page.getAttribute(<span>&#8220;description&#8221;<\/span>).getFormat();<\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;The format of description is &#8220;<\/span>+ attributeFormat);<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><a href=\"http:\/\/1.bp.blogspot.com\/-m9k7ZElK9zU\/UeOHJ9yOPuI\/AAAAAAAAB_8\/VcON9e_ghu4\/s1600\/8.jpg\" imageanchor=\"1\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/1.bp.blogspot.com\/-m9k7ZElK9zU\/UeOHJ9yOPuI\/AAAAAAAAB_8\/VcON9e_ghu4\/s1600\/8.jpg\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><span><span><\/span><\/span><\/div>\n<div><\/div>\n<div><span><span>\u00a0\u00a0\u00a0 }<\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0 <span>catch<\/span> (e) {<\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert(<span>&#8220;GetFormatOfAttributes Err >> &#8220;<\/span> + e.description);<\/span><\/span><\/div>\n<div><span><span>\u00a0\u00a0\u00a0 }<\/span><\/span><\/div>\n<div><span><span>}<\/span><\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Now we can check the attribute formats in CRM java script. To do this you just need to use the function \u201cgetFormat\u201d. This function returns a string value that represents formatting options for the attribute. You can refer the below code to check the format of different types of attributes. functionGetFormatOfAttributes() { \u00a0\u00a0\u00a0 var attributeFormat;\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2013\/07\/check-attribute-typeformats-in-crm-2011-javascript\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19,20,21,22,24,33],"tags":[382,389],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm","category-dynamics-crm-2011","category-dynamics-crm-2013","category-dynamics-crm-2015","category-dynamics-crm-2016","category-javascript","tag-crm-2011-attribute-format","tag-crm-2011-script"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}