-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4e6be57
Showing
8 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.alpackages | ||
.vscode | ||
*.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
page 50101 "Contact Relation" | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Contact Relations'; | ||
PageType = List; | ||
SourceTable = "Contact Relation"; | ||
UsageCategory = Lists; | ||
|
||
layout | ||
{ | ||
area(content) | ||
{ | ||
repeater(General) | ||
{ | ||
field("No."; "No.") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Contact No."; "Contact No.") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Contact Name"; "Contact Name") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Description"; Description) | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Relation to Contact No."; "Relation to Contact No.") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Relation to Contact Name"; "Relation to Contact Name") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
page 50102 "Contact Relation Api" | ||
{ | ||
|
||
APIGroup = 'nav'; | ||
APIPublisher = 'publisher'; | ||
APIVersion = 'v1.0'; | ||
DelayedInsert = true; | ||
EntityName = 'relation'; | ||
EntitySetName = 'relations'; | ||
ODataKeyFields = "No."; | ||
PageType = API; | ||
SourceTable = "Contact Relation"; | ||
|
||
layout | ||
{ | ||
area(content) | ||
{ | ||
repeater(General) | ||
{ | ||
field(number; "No.") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'no'; | ||
} | ||
field(contactNo; "Contact No.") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'contactNo'; | ||
} | ||
field(relationToContactNo; "Relation to Contact No.") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'relationToContactNo'; | ||
} | ||
field(description; "Description") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'description'; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
page 50103 "Contact Api" | ||
{ | ||
|
||
APIGroup = 'nav'; | ||
APIPublisher = 'publisher'; | ||
APIVersion = 'v1.0'; | ||
DelayedInsert = true; | ||
EntityName = 'contact'; | ||
EntitySetName = 'contacts'; | ||
PageType = API; | ||
SourceTable = Contact; | ||
|
||
layout | ||
{ | ||
area(content) | ||
{ | ||
repeater(General) | ||
{ | ||
field(number; "No.") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'number', Locked = true; | ||
} | ||
field(firstName; "First Name") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'firstName', Locked = true; | ||
} | ||
field(surname; Surname) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'surname', Locked = true; | ||
} | ||
field(name; Name) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'name', locked = true; | ||
} | ||
field(id; SystemId) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'id'; | ||
} | ||
field(companyNo; "Company No.") | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'companyNo'; | ||
} | ||
|
||
part(relations; 50102) | ||
{ | ||
ApplicationArea = All; | ||
EntityName = 'relation'; | ||
EntitySetName = 'relations'; | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
table 50100 "Contact Relation" | ||
{ | ||
Caption = 'Contact Relation'; | ||
DataClassification = CustomerContent; | ||
|
||
fields | ||
{ | ||
field(1; "No."; Code[10]) | ||
{ | ||
Caption = 'Entry No'; | ||
DataClassification = CustomerContent; | ||
} | ||
field(2; "Contact No."; Code[20]) | ||
{ | ||
TableRelation = Contact."No."; | ||
} | ||
field(3; "Relation to Contact No."; Code[20]) | ||
{ | ||
TableRelation = Contact."No."; | ||
|
||
} | ||
field(4; "Description"; Text[50]) | ||
{ | ||
Caption = 'Description'; | ||
DataClassification = CustomerContent; | ||
} | ||
field(5; "Contact Name"; Text[50]) | ||
{ | ||
FieldClass = FlowField; | ||
CalcFormula = lookup (Contact.Name where("No." = field("Contact No."))); | ||
} | ||
field(6; "Relation to Contact Name"; Text[50]) | ||
{ | ||
FieldClass = FlowField; | ||
CalcFormula = lookup (Contact.Name where("No." = field("Relation to Contact No."))); | ||
} | ||
} | ||
keys { key(PK; "No.") { } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"id": "6d2eaf41-642c-41ff-81ce-c3cc06d9d3c4", | ||
"name": "api navigation", | ||
"publisher": "publisher", | ||
"version": "1.0.0.0", | ||
"brief": "", | ||
"description": "", | ||
"privacyStatement": "", | ||
"EULA": "", | ||
"help": "", | ||
"url": "", | ||
"logo": "", | ||
"dependencies": [ | ||
{ | ||
"id": "63ca2fa4-4f03-4f2b-a480-172fef340d3f", | ||
"publisher": "Microsoft", | ||
"name": "System Application", | ||
"version": "16.0.0.0" | ||
}, | ||
{ | ||
"id": "437dbf0e-84ff-417a-965d-ed2bb9650972", | ||
"publisher": "Microsoft", | ||
"name": "Base Application", | ||
"version": "16.0.0.0" | ||
} | ||
], | ||
"screenshots": [], | ||
"platform": "16.0.0.0", | ||
"idRanges": [ | ||
{ | ||
"from": 50100, | ||
"to": 50149 | ||
} | ||
], | ||
"showMyCode": true, | ||
"runtime": "5.0" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
This is a spike project to explore both the REST Webservices and the new custom API of Business Central. My interest here is especially in the O-Data navigation features. I would like to query whole entity trees with only a single call using $expand. The [documentation](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/use-containments-associations) I have found so far on the subject is extremely scarce and also outdated. | ||
|
||
### A simple relation beween contacts | ||
|
||
For this purpose there is a simple table called `Tab50100.ContactRelation`. | ||
|
||
``` | ||
table 50100 "Contact Relation" | ||
{ | ||
Caption = 'Contact Relation'; | ||
DataClassification = CustomerContent; | ||
fields | ||
{ | ||
field(1; "No."; Code[10]) | ||
{ | ||
DataClassification = CustomerContent; | ||
} | ||
field(2; "Contact No."; Code[20]) | ||
{ | ||
TableRelation = Contact ."No."; | ||
} | ||
field(3; "Relation to Contact No."; Code[20]) | ||
{ | ||
TableRelation = Contact."No."; | ||
} | ||
field(4; "Description"; Text[50]) | ||
{ | ||
DataClassification = CustomerContent; | ||
} | ||
/* ...and some flow fields for convienience ... */ | ||
} | ||
keys { key(PK; "No."){}} | ||
} | ||
``` | ||
For each contact a list of their relationships (e.g. "Child" or "Partner of") to other contacts can now be stored. Therefore the table contains the two fields `Contact No` and `Relation to Contact No.` which handle the table relations to the built in table `Contact` (5050). | ||
|
||
### A Page for Editing | ||
|
||
For a basic editing UI, I created a page of type list `Page50101.ContactRelation`: | ||
|
||
``` | ||
page 50101 "Contact Relation" | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Contact Relations'; | ||
PageType = List; | ||
SourceTable = "Contact Relation"; | ||
UsageCategory = Lists; | ||
layout | ||
{ | ||
area(content) | ||
{ | ||
repeater(General) | ||
{ | ||
field("No."; "No.") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Contact No."; "Contact No.") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Description"; Description) | ||
{ | ||
ApplicationArea = All; | ||
} | ||
field("Relation to Contact No."; "Relation to Contact No.") | ||
{ | ||
ApplicationArea = All; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
This allows me to enter a few relations: | ||
 | ||
|
||
|
||
### |