[Error] customer already has a contact business relation with contact
mysamza
Member Posts: 66
I created two tables called Category and Sector that has two table fields each Code and Description. On the customer table, I extended it to have Code of Category and Code of Sector. I then added those two page fields on the Customer Card page and when I insert the data I get the following error.
customer already has a contact business relation with contact
Here is my code;
customer already has a contact business relation with contact
Here is my code;
{
DataClassification = ToBeClassified;
LookupPageId = "Customer Sector";
fields
{
field(50000; "Code"; Code[20])
{
DataClassification = ToBeClassified;
}
field(50001; "Description"; Text[50])
{
DataClassification = ToBeClassified;
}
}
keys
{
key(PK; Code)
{
Clustered = true;
}
}
var
myInt: Integer;
trigger OnInsert()
begin
end;
trigger OnModify()
begin
end;
trigger OnDelete()
begin
end;
trigger OnRename()
begin
end;
}
table 50133 "myCategorytable"
{
DataClassification = ToBeClassified;
LookupPageID = "Customer Category";
fields
{
field(50000; "Code"; Code[20])
{
DataClassification = ToBeClassified;
}
field(50001; "Description"; Text[50])
{
DataClassification = ToBeClassified;
}
}
keys
{
key(PK; Code)
{
Clustered = true;
}
}
var
myInt: Integer;
trigger OnInsert()
begin
end;
trigger OnModify()
begin
end;
trigger OnDelete()
begin
end;
trigger OnRename()
begin
end;
}
page 50136 "Customer Category"
{
PageType = List;
Editable = true;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = myCategorytable;
layout
{
area(Content)
{
repeater(Category)
{
field(Code; Code)
{
ApplicationArea = All;
NotBlank = true;
ShowMandatory = true;
}
field(Description; Description)
{
ApplicationArea = All;
}
}
}
}
actions
{
area(Processing)
{
action(ActionName)
{
ApplicationArea = All;
trigger OnAction()
begin
end;
}
}
}
var
myInt: Integer;
}
page 50135 "Customer Sector"
{
PageType = List;
Editable = true;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = mySectortable;
layout
{
area(Content)
{
repeater(Sector)
{
field(Code; Code)
{
ApplicationArea = All;
NotBlank = true;
ShowMandatory = true;
}
field(Description; Description)
{
ApplicationArea = All;
}
}
}
}
actions
{
area(Processing)
{
action(ActionName)
{
ApplicationArea = All;
trigger OnAction()
begin
end;
}
}
}
var
myInt: Integer;
}
tableextension 50121 "Customer Table Ext" extends Customer
{
fields
{
// Add changes to table fields here
field(50000; "Customer Category"; Code[20])
{
TableRelation = myCategorytable;
}
field(50001; "Customer Sector"; Code[20])
{
TableRelation = mySectortable;
}
field(50002; "Location"; Code[10])
{
TableRelation = Location;
}
}
var
myInt: Integer;
}
pageextension 50122 "Customer Card Ext" extends "Customer Card"
{
layout
{
// Add changes to page layout here
addafter("Disable Search by Name")
{
field("Category"; recCategory.Code)
{
ApplicationArea = All;
TableRelation = Category_DSSS;
trigger OnValidate()
var
recCustomer: Record Customer;
begin
recCustomer.SetFilter("No.", Rec."No.");
IF recCustomer.FindFirst() then begin
recCustomer."Customer Category" := rec."Customer Category";
recCustomer.Insert(true);
end;
end;
}
field("Sector"; recSector.Code)
{
ApplicationArea = All;
TableRelation = Sector_DSSS;
trigger OnValidate()
var
recCustomer: Record Customer;
begin
recCustomer.SetFilter("No.", Rec."No.");
IF recCustomer.FindFirst() then begin
recCustomer."Customer Sector" := rec."Customer Sector";
recCustomer.Insert(true);
end;
end;
}
}
addafter("Language Code")
{
field(Location; Location)
{
ApplicationArea = All;
TableRelation = Location;
trigger OnValidate()
var
recCustomer: Record Customer;
begin
IF recCustomer.FindFirst() then begin
recCustomer.Location := rec.Location;
recCustomer.Insert(true);
end;
// CurrPage.SaveRecord();
end;
}
}
}
actions
{
// Add changes to page actions here
}
var
recCategory: Record Category_DSSS;
recSector: Record Sector_DSSS;
}
0
Answers
-
*ignore* recCategory: Record Category_DSSS;
recSector: Record Sector_DSSS;
It is recCategory: Record myCategorytable;
recSector: Record mySectortable;
I copied the wrong part of the code here.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions