{"id":2396,"date":"2022-07-11T18:55:28","date_gmt":"2022-07-11T13:55:28","guid":{"rendered":"https:\/\/omar-iqbal.com\/?p=2396"},"modified":"2023-11-23T19:06:44","modified_gmt":"2023-11-23T14:06:44","slug":"set-financial-dimension-combination-for-purchase-line-using-x","status":"publish","type":"post","link":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/","title":{"rendered":"Set Financial Dimension combination for Purchase line using X++"},"content":{"rendered":"\n<p>In this article we will see how to set financial dimension combination for a PurchLine using X++ code.<\/p>\n\n\n\n<p>Please follow the code below to set the financial dimensions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">        PurchLine                           purchLine;\n        DimensionAttributeValueSetStorage   dimensionAttributeValueSetStorage;\n        DimensionAttributeValue             dimensionAttributeValue;\n        DimensionAttribute                  dimensionAttribute;\n        container                           financialDimensionName;\n        container                           financialDimensionValue;\n        int                                 i;\n\n        financialDimensionName  = ['BusinessUnit', 'CostCenter', 'Department', 'ItemGroup', 'Project'];\n        financialDimensionValue = ['001', '007', '022', 'AudioRM', '000002'];\n\n        purchLine  =  PurchLine::find('000038', 1);\n\n        dimensionAttributeValueSetStorage = new DimensionAttributeValueSetStorage();\n\n        for (i = 1; i &lt;= conLen(financialDimensionName); i++)\n        {\n            dimensionAttribute      = DimensionAttribute::findByName(conPeek(financialDimensionName, i));\n            dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, conPeek(financialDimensionValue, i), false, true);\n            \n            if (dimensionAttributeValue)\n            {\n                dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);\n            }\n        }\n\n        ttsBegin;\n        purchLine.selectForUpdate(true);\n        purchLine.DefaultDimension = dimensionAttributeValueSetStorage.save();\n        purchLine.update();\n        ttsCommit;\n<\/pre>\n\n\n\n<p>You can use the same code for others like Sales line etc. just replace the PurchLine buffer with the SalesLine etc.<\/p>\n\n\n\n<p>Thank you for reading this article hope you find it useful.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.linkedin.com\/in\/omar-iqbal-here\/\" target=\"_blank\" rel=\"noreferrer noopener\">Omar Iqbal<\/a><\/p>\n\n\n\n<p>Technical Consultant<\/p>\n","protected":false},"excerpt":{"rendered":"In this article we will see how to set financial dimension combination for a PurchLine using X++ code.&hellip;\n","protected":false},"author":1,"featured_media":2399,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19,30],"tags":[21,41,20,33,31],"class_list":{"0":"post-2396","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-finance-operations","8":"category-x","9":"tag-finance-operations","10":"tag-financial-dimension","11":"tag-finops","12":"tag-microsoft-dynamics-ax","13":"tag-x","14":"cs-entry","15":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Set Financial Dimension combination for Purchase line using X++ - Omar Iqbal&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set Financial Dimension combination for Purchase line using X++ - Omar Iqbal&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"In this article we will see how to set financial dimension combination for a PurchLine using X++ code.&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\" \/>\n<meta property=\"og:site_name\" content=\"Omar Iqbal&#039;s Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/umerk26\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-11T13:55:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-23T14:06:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"518\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"omar_iqbal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/omarshykh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"omar_iqbal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\"},\"author\":{\"name\":\"omar_iqbal\",\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4\"},\"headline\":\"Set Financial Dimension combination for Purchase line using X++\",\"datePublished\":\"2022-07-11T13:55:28+00:00\",\"dateModified\":\"2023-11-23T14:06:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\"},\"wordCount\":73,\"image\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg\",\"keywords\":[\"Finance &amp; Operations\",\"Financial Dimension\",\"FinOps\",\"Microsoft Dynamics AX\",\"X++\"],\"articleSection\":[\"Finance &amp; Operations\",\"X++\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\",\"url\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\",\"name\":\"Set Financial Dimension combination for Purchase line using X++ - Omar Iqbal&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/omar-iqbal.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg\",\"datePublished\":\"2022-07-11T13:55:28+00:00\",\"dateModified\":\"2023-11-23T14:06:44+00:00\",\"author\":{\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4\"},\"breadcrumb\":{\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage\",\"url\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg\",\"contentUrl\":\"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg\",\"width\":518,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/omar-iqbal.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Finance &amp; Operations\",\"item\":\"https:\/\/omar-iqbal.com\/index.php\/category\/finance-operations\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Set Financial Dimension combination for Purchase line using X++\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/omar-iqbal.com\/#website\",\"url\":\"https:\/\/omar-iqbal.com\/\",\"name\":\"Omar Iqbal&#039;s Blog\",\"description\":\"Associate Technical Consultant\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/omar-iqbal.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4\",\"name\":\"omar_iqbal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/omar-iqbal.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g\",\"caption\":\"omar_iqbal\"},\"sameAs\":[\"https:\/\/omar-iqbal.com\",\"https:\/\/www.facebook.com\/umerk26\",\"https:\/\/www.instagram.com\/omariqbal_here\/\",\"https:\/\/www.linkedin.com\/in\/omar-iqbal-here\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/omarshykh\"],\"url\":\"https:\/\/omar-iqbal.com\/index.php\/author\/omar_iqbal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Set Financial Dimension combination for Purchase line using X++ - Omar Iqbal&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/","og_locale":"en_US","og_type":"article","og_title":"Set Financial Dimension combination for Purchase line using X++ - Omar Iqbal&#039;s Blog","og_description":"In this article we will see how to set financial dimension combination for a PurchLine using X++ code.&hellip;","og_url":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/","og_site_name":"Omar Iqbal&#039;s Blog","article_author":"https:\/\/www.facebook.com\/umerk26","article_published_time":"2022-07-11T13:55:28+00:00","article_modified_time":"2023-11-23T14:06:44+00:00","og_image":[{"width":518,"height":500,"url":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg","type":"image\/jpeg"}],"author":"omar_iqbal","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/omarshykh","twitter_misc":{"Written by":"omar_iqbal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#article","isPartOf":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/"},"author":{"name":"omar_iqbal","@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4"},"headline":"Set Financial Dimension combination for Purchase line using X++","datePublished":"2022-07-11T13:55:28+00:00","dateModified":"2023-11-23T14:06:44+00:00","mainEntityOfPage":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/"},"wordCount":73,"image":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage"},"thumbnailUrl":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg","keywords":["Finance &amp; Operations","Financial Dimension","FinOps","Microsoft Dynamics AX","X++"],"articleSection":["Finance &amp; Operations","X++"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/","url":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/","name":"Set Financial Dimension combination for Purchase line using X++ - Omar Iqbal&#039;s Blog","isPartOf":{"@id":"https:\/\/omar-iqbal.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage"},"image":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage"},"thumbnailUrl":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg","datePublished":"2022-07-11T13:55:28+00:00","dateModified":"2023-11-23T14:06:44+00:00","author":{"@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4"},"breadcrumb":{"@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#primaryimage","url":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg","contentUrl":"https:\/\/omar-iqbal.com\/wp-content\/uploads\/2022\/07\/financial_dimension_xpp.jpg","width":518,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/omar-iqbal.com\/index.php\/2022\/07\/11\/set-financial-dimension-combination-for-purchase-line-using-x\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/omar-iqbal.com\/"},{"@type":"ListItem","position":2,"name":"Finance &amp; Operations","item":"https:\/\/omar-iqbal.com\/index.php\/category\/finance-operations\/"},{"@type":"ListItem","position":3,"name":"Set Financial Dimension combination for Purchase line using X++"}]},{"@type":"WebSite","@id":"https:\/\/omar-iqbal.com\/#website","url":"https:\/\/omar-iqbal.com\/","name":"Omar Iqbal&#039;s Blog","description":"Associate Technical Consultant","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/omar-iqbal.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/bf76b3bc6da3287f49fd4713189accd4","name":"omar_iqbal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/omar-iqbal.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/77c8e6d449070e5f91d3609398694fed75736ca7b40f3b8b29a94259cb446d49?s=96&d=mm&r=g","caption":"omar_iqbal"},"sameAs":["https:\/\/omar-iqbal.com","https:\/\/www.facebook.com\/umerk26","https:\/\/www.instagram.com\/omariqbal_here\/","https:\/\/www.linkedin.com\/in\/omar-iqbal-here\/","https:\/\/x.com\/https:\/\/twitter.com\/omarshykh"],"url":"https:\/\/omar-iqbal.com\/index.php\/author\/omar_iqbal\/"}]}},"_links":{"self":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts\/2396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/comments?post=2396"}],"version-history":[{"count":2,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts\/2396\/revisions"}],"predecessor-version":[{"id":2398,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/posts\/2396\/revisions\/2398"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/media\/2399"}],"wp:attachment":[{"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/media?parent=2396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/categories?post=2396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/omar-iqbal.com\/index.php\/wp-json\/wp\/v2\/tags?post=2396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}