{"id":9053,"date":"2024-09-04T06:34:40","date_gmt":"2024-09-04T06:34:40","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=9053"},"modified":"2024-09-06T07:11:01","modified_gmt":"2024-09-06T07:11:01","slug":"delete-custom-blocks-fields-in-vtiger-crm-easily","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/delete-custom-blocks-fields-in-vtiger-crm-easily\/","title":{"rendered":"Delete Custom Blocks &amp; Fields in Vtiger CRM Easily"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 2,033<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p class=\"wp-block-paragraph\">If you need to delete custom blocks or custom field in Vtiger CRM programmatically (using code), you can do this by directly interacting with the Vtiger database or using Vtiger&#8217;s API. Below are the steps for both approaches. Note that directly modifying the database can be risky and should be done with caution. Always back up your data before making changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Using Vtiger API<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer a safer method, you can use Vtiger&#8217;s API to delete custom fields and blocks. Here\u2019s how you can do it using the API:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Delete a Custom Field<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Obtain API Access:<\/strong><br>Ensure you have access to Vtiger\u2019s API and obtain an API key or authentication token.<\/li>\n\n\n\n<li><strong>Create a Request to Delete the Field:<\/strong><br>Use a REST API client or code to send a request to Vtiger\u2019s API. For example, you might use cURL or a programming language like Python. <strong>Example using cURL:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">curl -X POST \"https:\/\/your-vtiger-url\/webservice.php\" \\\n   -d \"operation=delete\" \\\n   -d \"sessionName=YOUR_SESSION_ID\" \\\n   -d \"elementType=Field\" \\\n   -d \"elementID=FIELD_ID\"<\/mark><\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Replace:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">YOUR_SESSION_ID<\/mark><\/code> with your active session ID.<\/li>\n\n\n\n<li><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">FIELD_ID<\/mark><\/code> with the ID of the field you want to delete.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">     3. <strong>Check API Documentation:<\/strong><br>Refer to the Vtiger API documentation for specific details about deleting custom fields or blocks, as the exact parameters and methods can vary.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Delete a Custom Block<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Vtiger\u2019s API might not provide direct support for deleting blocks. In this case, you may need to manually edit the module layout via the database or use a combination of the API and manual adjustments.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>Direct Database Modification<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> This approach involves directly modifying the database, which can be risky. Ensure you have a backup of your database before proceeding.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Delete a Custom Field<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Identify the Field:<\/strong><br>Determine the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">fieldid<\/mark><\/code> of the custom field you want to delete.<\/li>\n\n\n\n<li><strong>Connect to Your Database:<\/strong><br>Use a database management tool like phpMyAdmin or a database client.<\/li>\n\n\n\n<li><strong>Execute SQL Commands:<\/strong><br>Run the following SQL commands to delete the custom field. Replace <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">fieldid<\/mark><\/code> with the actual ID of the field.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">-- Delete the field from the field table\n   DELETE FROM vtiger_field WHERE fieldid = 'FIELD_ID';\n\n   -- Optionally, clean up related entries\n   DELETE FROM vtiger_fieldmodulerel WHERE fieldid = 'FIELD_ID';<\/mark><\/code><\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>Clear Cache and Rebuild Indexes:<\/strong><br>Clear any caches and rebuild indexes if necessary to ensure the system reflects the changes.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Delete a Custom Block<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Identify the Block:<\/strong><br>Determine the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">blockid<\/mark><\/code> of the custom block you want to delete.<\/li>\n\n\n\n<li><strong>Connect to Your Database:<\/strong><br>Use a database management tool.<\/li>\n\n\n\n<li><strong>Execute SQL Commands:<\/strong><br>Run the following SQL commands to delete the custom block. Replace <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">blockid<\/mark><\/code> with the actual ID of the block.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">-- Delete the block from the block table\n   DELETE FROM vtiger_blocks WHERE blockid = 'BLOCK_ID';\n\n   -- Optionally, clean up related entries\n   DELETE FROM vtiger_field WHERE blockid = 'BLOCK_ID';<\/mark><\/code><\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>Clear Cache and Rebuild Indexes:<\/strong><br>Clear any caches and rebuild indexes if necessary.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Additional Considerations<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Testing:<\/strong> Always test changes in a staging environment before applying them to production.<\/li>\n\n\n\n<li><strong>Backup:<\/strong> Ensure you have a full backup of your Vtiger CRM and database before making changes.<\/li>\n\n\n\n<li><strong>Documentation:<\/strong> Review Vtiger documentation or consult with Vtiger support if unsure about the process.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">By using these methods, you can programmatically delete custom blocks and fields in Vtiger CRM. If you\u2019re not comfortable with direct database manipulation, using the API or seeking help from a developer might be the safer route.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Conclusion<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to delete any specific custom block or field in the case of the <a href=\"https:\/\/www.infinitivehost.com\/managed-vtiger-solutions\"><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color has-black-color\"><strong>best Vtiger hosting solutions<\/strong><\/mark><\/a> with the help of code, you can easily do all this by directly relating with the database of Vtiger or utilizing Vtiger\u2019s API. Several above-mentioned steps for types of approaches. Remember that directly changing the database can be very dangerous. Always back up your data on time before making any type of changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2,033 Views If you need to delete custom blocks or custom field in Vtiger CRM programmatically (using code), you can do this by directly interacting with the Vtiger database or using Vtiger&#8217;s API. Below are the steps for both approaches. Note that directly modifying the database can be risky and should be done with caution. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[204],"tags":[],"class_list":["post-9053","post","type-post","status-publish","format-standard","hentry","category-vtiger-solutions"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=9053"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9053\/revisions"}],"predecessor-version":[{"id":9080,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/9053\/revisions\/9080"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=9053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=9053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=9053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}