{"id":5595,"date":"2016-08-18T04:54:21","date_gmt":"2016-08-18T04:54:21","guid":{"rendered":"http:\/\/www.jitendrazaa.com\/blog\/?p=5595"},"modified":"2016-08-18T04:54:21","modified_gmt":"2016-08-18T04:54:21","slug":"dynamically-remove-xml-content-from-metadata-before-salesforce-deployment-using-xmltask-video","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/dynamically-remove-xml-content-from-metadata-before-salesforce-deployment-using-xmltask-video\/","title":{"rendered":"Dynamically remove XML content from metadata before Salesforce deployment using xmlTask &#8211; Video"},"content":{"rendered":"<p style=\"text-align: justify;\">Many post about <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/ant\/\">deployment using ANT<\/a> has been posted on this blog like <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/automated-daily-backup-using-ant-migration-tool-and-git\/\">auto backup complete Salesforce instance daily<\/a>, <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/using-dataloader-and-ant-to-backup-salesforce-data-on-ftp-server-video\/\">upload Salesforce data\u00a0on FTP Server<\/a>, <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/auto-generate-package-xml-using-ant-complete-source-code-and-video\/\">auto generate package.xml<\/a>, <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/continuous-integration-in-salesforce-using-jenkins-and-git-video-tutorial\/\">continuous integration<\/a> and <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/ant-migration-tool\/\">so on<\/a>.<\/p>\n<p style=\"text-align: justify;\">While implementing real <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/continuous-integration-in-salesforce-using-jenkins-and-git-video-tutorial\/\">Continuous integration<\/a> in Salesforce, we need to perform various adjustments in metadata before deploying it to build server or production instance, many\u00a0automated scripts (automation) are needed. If you need to change ANT scripts or metadata frequently, then it means continuous integration or deployment process in your Salesforce project is not yet fully matured.<\/p>\n<p style=\"text-align: justify;\">There could be multiple situation where we don&#8217;t want some component to be deployed on production and <strong>example\u00a0<\/strong>of\u00a0one of them is\u00a0<strong><em>List view<\/em>.\u00a0<\/strong><!--more--><\/p>\n<p style=\"text-align: justify;\">When we include any custom or Standard object as a part of <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/ant-migration-tool\/\">ANT deployment<\/a>, it also includes <em>listview<\/em>\u00a0created on that object. It is very common, that developer changes or creates multiple <em>listviews<\/em> for data analysis purposes. In that case, Listview created by customer could we overwritten after deployment and believe me, as a developer or consultant you don&#8217;t want to make customers unhappy \ud83d\ude42 .<\/p>\n<p style=\"text-align: justify;\">In this post, we will discuss how we can tweak Salesforce metadata dynamically in ANT with the help of <a href=\"http:\/\/www.oopsconsultancy.com\/software\/xmltask\/\"><strong>xmlTask<\/strong><\/a>.<\/p>\n<p><strong>build.properties<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nxmlTaskjarFile=xmltask.jar\r\nroot.dir=C:\\\\Users\\\\Jitendra\\\\Desktop\\\\Blog Demo\r\n<\/pre>\n<p style=\"text-align: justify;\">In above file,\u00a0<em>root.dir\u00a0<\/em>contains complete path till working folder and\u00a0<em>xmlTaskjarFile<\/em> contains name of jar file downloaded from <a href=\"http:\/\/www.oopsconsultancy.com\/software\/xmltask\/\">here<\/a>. This jar file is placed in same location where build.properties exists.<\/p>\n<p><strong>Build.xml<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;project name=&quot;Deployment Scripts&quot; default=&quot;removeListViews&quot; basedir=&quot;.&quot; xmlns:sf=&quot;antlib:com.salesforce&quot;&gt;\r\n \t   \r\n    &lt;property file=&quot;build.properties&quot;\/&gt;\r\n    &lt;property environment=&quot;env&quot;\/&gt;  \r\n\t\r\n\t&lt;target name=&quot;removeListViews&quot;&gt;   \r\n\t\t\r\n\t\t&lt;taskdef name=&quot;xmltask&quot; classname=&quot;com.oopsconsultancy.xmltask.ant.XmlTask&quot; classpath=&quot;${xmlTaskjarFile}&quot;\/&gt; \t\t\r\n\t\t&lt;xmltask source=&quot;${root.dir}\/src\/objects\/Account.object&quot; dest=&quot;${root.dir}\/src\/objects\/Account.object&quot;&gt; \r\n\t\t\t&lt;remove path=&quot;\/:CustomObject\/:listViews&quot;\/&gt; \r\n\t\t&lt;\/xmltask&gt;   \r\n\t&lt;\/target&gt; \t\r\n&lt;\/project&gt;\r\n<\/pre>\n<p style=\"text-align: justify;\">As shown in above\u00a0<em>build.xml\u00a0<\/em>file, we have defined target by name\u00a0<em>removeListViews.\u00a0<\/em>This target can be called before Salesforce deployment target. It removes any listview found by using\u00a0<a href=\"http:\/\/www.w3schools.com\/xsl\/xpath_intro.asp\">XPath<\/a>\u00a0from Account Object. Don&#8217;t forget to make a note of\u00a0<em>\/:\u00a0<\/em>before\u00a0<em>CustomObject.\u00a0<\/em>I struggled a lot to identify why node is not being removed.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/XMLTaskDemo.zip\">Download<\/a>\u00a0example of this post.<\/p>\n<p><iframe loading=\"lazy\" title=\"XMLTask usage in Salesforce\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/PPlWekZzR9I?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Example &#8211; automatically remove listview before deployment<\/p>\n","protected":false},"author":1,"featured_media":5650,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[9],"tags":[261,262,212],"class_list":["post-5595","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","tag-ant","tag-ant-migration-tool","tag-video-tutorial"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/2016-07-15.png?fit=922%2C519&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":5478,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/delete-components-using-ant-migration-tool-video\/","url_meta":{"origin":5595,"position":0},"title":"Delete Components using Ant Migration tool &#8211; Video","author":"Jitendra","date":"April 27, 2016","format":false,"excerpt":"This video tutorial shows that how we can delete components like Apex class, trigger from Salesforce using ANT migration tool.","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/img.youtube.com\/vi\/3kMGy6OeJAc\/0.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2892,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-migration-tool-ant\/","url_meta":{"origin":5595,"position":1},"title":"Complete Salesforce Deployment Guide using Ant Migration Tool","author":"Jitendra","date":"June 5, 2012","format":false,"excerpt":"Step by Step tutorial of Salesforce Migration using ANT tool with Proxy settings and retrieving content from Salesforce Organization. Also fix some common errors like java.lang.OutOfMemoryError or unable to find tools.jar","rel":"","context":"In &quot;Configuration&quot;","block_context":{"text":"Configuration","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/configuration\/"},"img":{"alt_text":"Salesforce Get ANT version ","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/Salesforce-Get-ANT-version-Original.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/Salesforce-Get-ANT-version-Original.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/Salesforce-Get-ANT-version-Original.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5935,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/continuous-integration-ci-in-salesforce-using-team-foundation-server-tfs-video\/","url_meta":{"origin":5595,"position":2},"title":"Continuous Integration (CI) in Salesforce using Team Foundation Server (TFS) &#8211; Video","author":"Jitendra","date":"March 20, 2017","format":false,"excerpt":"Step by step guide to set up Continuous Integration (CI) for Salesforce using Team Foundation Server (TFS) with video tutorial","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Team Foundation Server (TFS) - New Build definition - Select repository","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/Team-Foundation-Server-TFS-New-Build-definition-Select-repository.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4584,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/continuous-integration-in-salesforce-using-flosum-appexchange\/","url_meta":{"origin":5595,"position":3},"title":"Continuous Integration in Salesforce using Flosum AppExchange","author":"Jitendra","date":"June 22, 2015","format":false,"excerpt":"Native Force.com solution for Continuous Integration using AppExchange product Flosum","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Flosum AppExchange","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Flosum-AppExchange.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Flosum-AppExchange.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Flosum-AppExchange.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/06\/Flosum-AppExchange.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4826,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/setup-live-agent-in-salesforce-community\/","url_meta":{"origin":5595,"position":4},"title":"Setup Live Agent in Salesforce Community &#8211; Video","author":"Jitendra","date":"September 22, 2015","format":false,"excerpt":"Using Live agent, Service representatives can directly chat with customers and resolve customer issue. Chat support is noways preferable way to contact service representative. No need to stay on call for hours, no need to wait for email reply for days. Even I use chat support wherever it is possible\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"LiveAgent in Community Demo","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/09\/LiveAgent-in-Community-Demo.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/09\/LiveAgent-in-Community-Demo.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/09\/LiveAgent-in-Community-Demo.gif?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/09\/LiveAgent-in-Community-Demo.gif?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/09\/LiveAgent-in-Community-Demo.gif?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/09\/LiveAgent-in-Community-Demo.gif?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":3409,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/setting-up-liveagent-in-salesforce-video-tutorial\/","url_meta":{"origin":5595,"position":5},"title":"Setting up LiveAgent in Salesforce &#8211; Video Tutorial","author":"Jitendra","date":"July 26, 2013","format":false,"excerpt":"This Video tutorial will help on basics of LiveAgent in Salesforce. It will Explain How to enable Live Agent How to add Chat Buttons How to add Skills and Agent Configuration Adding Deployment Chartlets Setup Service Cloud Console to use with Live Agent Video Tutorial:","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/5595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=5595"}],"version-history":[{"count":10,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/5595\/revisions"}],"predecessor-version":[{"id":5656,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/5595\/revisions\/5656"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media\/5650"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=5595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=5595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=5595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}