{"id":22577,"date":"2026-08-04T10:43:26","date_gmt":"2026-08-04T10:43:26","guid":{"rendered":"https:\/\/tenthplanet.in\/idempiere\/?p=22577"},"modified":"2026-08-13T04:45:37","modified_gmt":"2026-08-13T04:45:37","slug":"how-to-configure-create-foreign-key-in-idempiere","status":"publish","type":"post","link":"https:\/\/tenthplanet.in\/idempiere\/how-to-configure-create-foreign-key-in-idempiere\/","title":{"rendered":"How to Configure Create Foreign Key in iDempiere"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The Create Foreign Key window is a System Administration process in iDempiere that generates and synchronizes database-level foreign key constraints based on the Reference Table settings defined on AD_Column.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Running this process protects referential integrity across sales, inventory, and customer data, preventing orphaned records as store-specific customizations grow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Process Flow<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"311\" src=\"https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1024x311.png\" alt=\"\" class=\"wp-image-22578\" title=\"\" srcset=\"https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1024x311.png 1024w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-300x91.png 300w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-768x233.png 768w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1536x466.png 1536w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-2048x622.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Business Rules<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Only columns with a Reference Table set on AD_Column are eligible for foreign key creation.<\/li>\n\n\n\n<li>Key columns and UUID columns are excluded from foreign key generation automatically.<\/li>\n\n\n\n<li>AD_Client_ID, AD_Org_ID, CreatedBy and UpdatedBy columns are skipped by default.<\/li>\n\n\n\n<li>Existing database constraints are compared against AD_Column settings before any change.<\/li>\n\n\n\n<li>Mismatched constraints are dropped and recreated to match the FK Constraint Type on the column.<\/li>\n\n\n\n<li>Running at table or database level processes every eligible column found in that scope.<\/li>\n\n\n\n<li>The process can be scheduled as a background job for large retail table syncs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Prerequisites<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Custom table registered in Application Dictionary (Table and Column window).<\/li>\n\n\n\n<li>Column created with the correct Reference Table pointing to the parent table.<\/li>\n\n\n\n<li>FK Constraint Type set on the column, if non-default behavior is required.<\/li>\n\n\n\n<li>Database user has ALTER TABLE privileges on the target schema.<\/li>\n\n\n\n<li>Table synchronized with the physical database (Sync This Column \/ Table completed).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Note: <\/strong>Leaving Table blank scans every registered table in the database and may take significant time on production retail environments.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Navigation<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Menu \u2192 System Admin \u2192 General Rules \u2192 Database \u2192 Create Foreign Key<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Configuration Steps<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Open the Create Foreign Key Process<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the search bar and type &#8220;creat&#8221; to filter, then select Create Foreign Key from the process list to open the parameter window.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"308\" src=\"https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1-1024x308.png\" alt=\"\" class=\"wp-image-22579\" title=\"\" srcset=\"https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1-1024x308.png 1024w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1-300x90.png 300w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1-768x231.png 768w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1-1536x462.png 1536w, https:\/\/tenthplanet.in\/idempiere\/wp-content\/uploads\/sites\/13\/2026\/08\/TenthPlanet-iDempiere-CreateForeignKey-1.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Select the Target Table<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Choose the table from the Table dropdown, for example C_InvoiceLine. Leave Column blank to process all eligible columns on the table.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Select a Specific Column (Optional)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Select the column from the Column dropdown, for example QtyInvoiced. Leave it blank to process the entire table instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Field Reference Table<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td><strong>Field<\/strong><\/td><td><strong>Sample Value<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><\/thead><tbody><tr><td>Table<\/td><td>C_InvoiceLine_Invoice Line<\/td><td>Table whose columns are scanned for foreign key sync<\/td><\/tr><tr><td>Column<\/td><td>QtyInvoiced_Quantity Invoiced<\/td><td>Specific column to process; optional<\/td><\/tr><tr><td>Run as Job<\/td><td>Unchecked<\/td><td>Runs the process in the background scheduler queue<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Choose Run as Job for Large Syncs<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check Run as Job before clicking OK when syncing high-volume transaction tables during off-peak hours.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Execute and Review the Result Log<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Click OK to run. Review the result message showing table count, foreign keys created, and error count in the process log.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common Issues and Resolutions<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td><strong>Issue<\/strong><\/td><td><strong>Cause<\/strong><\/td><td><strong>Resolution<\/strong><\/td><\/tr><\/thead><tbody><tr><td>No foreign key created<\/td><td>Column has no Reference Table set<\/td><td>Set Reference Table on the column in Table and Column window<\/td><\/tr><tr><td>Constraint already exists error<\/td><td>A manually created DB constraint uses a different name<\/td><td>Let the process detect and reuse the existing constraint name<\/td><\/tr><tr><td>Column skipped silently<\/td><td>Column is AD_Client_ID, AD_Org_ID, CreatedBy or UpdatedBy<\/td><td>Set FK Constraint Type explicitly if a constraint is really needed<\/td><\/tr><tr><td>Process runs slowly on large tables<\/td><td>Full database or table-level sync scans many columns<\/td><td>Enable Run as Job and schedule during low-traffic hours<\/td><\/tr><tr><td>Constraint dropped unexpectedly<\/td><td>FK Constraint Type set to Do Not Create &#8211; Ignore<\/td><td>Change FK Constraint Type on the column before rerunning<\/td><\/tr><tr><td>Error count greater than zero<\/td><td>Data violates referential integrity (orphan records)<\/td><td>Clean up orphan child records before recreating the constraint<\/td><\/tr><tr><td>Key or UUID column not processed<\/td><td>Key and UUID columns are excluded by design<\/td><td>Expected behavior; no action needed<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Next Steps<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Table and Column window \u2013 define Reference Table and FK Constraint Type.<\/li>\n\n\n\n<li>Sync This Column \/ Sync Database process \u2013 align dictionary with DB schema.<\/li>\n\n\n\n<li>Reference and Reference List windows \u2013 set up lookup values for new columns.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The Create Foreign Key window is a System Administration process in iDempiere that generates and synchronizes database-level foreign key constraints [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,95],"tags":[],"class_list":["post-22577","post","type-post","status-publish","format-standard","hentry","category-idempiere-product","category-idempiere-application-dictionary"],"_links":{"self":[{"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/posts\/22577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/comments?post=22577"}],"version-history":[{"count":1,"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/posts\/22577\/revisions"}],"predecessor-version":[{"id":22580,"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/posts\/22577\/revisions\/22580"}],"wp:attachment":[{"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/media?parent=22577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/categories?post=22577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tenthplanet.in\/idempiere\/wp-json\/wp\/v2\/tags?post=22577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}