{"id":10909,"date":"2017-12-15T18:11:56","date_gmt":"2017-12-15T12:41:56","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=10909"},"modified":"2017-12-15T18:11:56","modified_gmt":"2017-12-15T12:41:56","slug":"dependent-attributes-in-javascript-in-dynamics-365-v9-0","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2017\/12\/dependent-attributes-in-javascript-in-dynamics-365-v9-0\/","title":{"rendered":"Dependent Attributes in JavaScript in Dynamics 365 v9.0"},"content":{"rendered":"<h2 style=\"text-align: justify;\"><strong>Introduction:<\/strong><\/h2>\n<p style=\"text-align: justify;\">Is Form Scripting a dreadful task, given the uncertainty that no one knows when the necessary attribute(s) for our script will be taken down from the form or it\u2019ll be deleted completely?<\/p>\n<p style=\"text-align: justify;\">Well! With Dynamics 365 v9.0, we can avoid these situations in a finesse way.<\/p>\n<p style=\"text-align: justify;\">Apart from the ability to handle the dependent JavaScript as described <a href=\"https:\/\/www.inogic.com\/blog\/2017\/11\/loading-dependent-javascript-files-in-dynamics-365-v9\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>, there is another feature which enables us to define the dependent attributes.<\/p>\n<h2 style=\"text-align: justify;\"><strong>Define Dependent Attributes in JavaScript:<\/strong><\/h2>\n<p style=\"text-align: justify;\">By tagging a dependent attribute(s) to the JavaScript, we don\u2019t have to worry about the attribute being or not being on the form.<\/p>\n<p style=\"text-align: justify;\">Also, by tagging a dependent attribute(s) to the JavaScript, Dynamics 365 v9.0 internal mechanism makes sure that the attribute(s) cannot be deleted. It shows the below error while attempting a delete.<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-10908\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/12\/Dependent-Attributes-in-JavaScript-in-Dynamics-365-V9.0.png\" alt=\"Dependent Attributes in JavaScript in Dynamics 365 V9.0\" width=\"548\" height=\"260\" \/><\/p>\n<p>How to add dependent attribute(s)?<\/p>\n<p style=\"padding-left: 30px;\"><strong>1<\/strong>. Open the JavaScript that needs to be tagged with Dependent Attribute(s).<\/p>\n<p style=\"padding-left: 30px;\"><strong>2<\/strong>. Select Dependencies tab.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter  wp-image-10906\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/12\/Dependent-Attributes-in-JavaScript-in-Dynamics-365-V9.0-1.png\" alt=\"Dependent Attributes in JavaScript in Dynamics 365 V9.0\" width=\"551\" height=\"130\" \/><\/p>\n<p style=\"padding-left: 30px;\"><strong>3<\/strong>. Go to the below table and add the Dependent Attribute(s).<\/p>\n<p style=\"padding-left: 30px;\"><img decoding=\"async\" class=\"aligncenter  wp-image-10907\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/12\/Dependent-Attributes-in-JavaScript-in-Dynamics-365-V9.0-2.png\" alt=\"Dependent Attributes in JavaScript in Dynamics 365 V9.0\" width=\"593\" height=\"341\" \/><\/p>\n<p style=\"text-align: justify;\">Lo! We can develop scripts without the dread of attribute(s) getting removed from the form and, hence, our logic going south.<\/p>\n<h2 style=\"text-align: justify;\">Conclusion:<\/h2>\n<ul>\n<li style=\"text-align: justify;\">After tagging the attribute to a JavaScript, it is not required to have the attribute on the form and still, we can use the value of the attribute.<\/li>\n<li style=\"text-align: justify;\">Tagging also makes sure that the attribute cannot be deleted.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.inogic.com\/product\/productivity-pack\/click-2-export-microsoft-dynamics-crm-reports\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter  wp-image-10791\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/11\/Click2Export.png\" alt=\"Easily Export Dynamics 365 Reports in PDF, Word, or Excel\" width=\"828\" height=\"207\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Is Form Scripting a dreadful task, given the uncertainty that no one knows when the necessary attribute(s) for our script will be taken down from the form or it\u2019ll be deleted completely? Well! With Dynamics 365 v9.0, we can avoid these situations in a finesse way. Apart from the ability to handle the dependent\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2017\/12\/dependent-attributes-in-javascript-in-dynamics-365-v9-0\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":10913,"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":[8,33],"tags":[167,589,971],"class_list":["post-10909","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-click2export","category-javascript","tag-attributes-in-javascript","tag-dynamics-365-v9-0","tag-javascript-2"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/10909","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=10909"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/10909\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/10913"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=10909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=10909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=10909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}