Customer - Contact relation.
Funkygraz
Member Posts: 12
On the customer card form (ID 21), if you assist in the primary contact field a form pops up listing the customers contacts. I need to show this list in a sub form on the customer card.
I figured i would make a sub form based on the Contact list and filter by the Company No. field. Untill i found out that the Company No. field (5051) in the contact table is referring to other contacts.
From the customer card i ended up in the contact business relations table. Is this where i should be looking? And, any tips to make it all link ( I tried looking at the customer card form's design to no avail )
I'm running Nav 5.0.
P.S: I'm new to Nav development so if there's any more info u need let me know
[Edit]
Just looking at the customer table C/AL code and i found:
Ill try to find the way|place to work / copy it now ^^
P.S.S: My first post gets a MUID of ANUB, go figure
I figured i would make a sub form based on the Contact list and filter by the Company No. field. Untill i found out that the Company No. field (5051) in the contact table is referring to other contacts.
From the customer card i ended up in the contact business relations table. Is this where i should be looking? And, any tips to make it all link ( I tried looking at the customer card form's design to no avail )
I'm running Nav 5.0.
P.S: I'm new to Nav development so if there's any more info u need let me know
[Edit]
Just looking at the customer table C/AL code and i found:
ContBusRel.SETCURRENTKEY("Link to Table","No.");
ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Customer);
ContBusRel.SETRANGE("No.","No.");
IF ContBusRel.FIND('-') THEN
Cont.SETRANGE("Company No.",ContBusRel."Contact No.");
IF "Primary Contact No." <> '' THEN
IF Cont.GET("Primary Contact No.") THEN ;
IF FORM.RUNMODAL(0,Cont) = ACTION::LookupOK THEN
VALIDATE("Primary Contact No.",Cont."No.");
Ill try to find the way|place to work / copy it now ^^
P.S.S: My first post gets a MUID of ANUB, go figure
0
Answers
-
Ive been trying to apply the code from the customer table to my form with no succes, anyone have any idea where i can find info on how to do this or can show me how to rework the code?
Thanks in advance
[EDIT]
My main form now has:ContBusRel.SETCURRENTKEY("Link to Table","No."); ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Customer); ContBusRel.SETRANGE("No.","No."); IF ContBusRel.FIND('-') THEN CurrForm.ContactListSubform.FORM.SetCustomerFilter(ContBusRel."Contact No.");
and on the subform the function looks like:SetCustomerFilter(Code CustFilter) SETFILTER("Company No.",CustFilter); CurrForm.UPDATE(FALSE);
And it works, thanks for the feedback ^^0 -
Hi Funkygraz,
Create a Function on the Subform(subform name :navuser1)
Function name :- SetSubformLines
Local Parameter name : lCont (Code 100)
CAL code of Function :
SETRANGE("Company No.",lCont);
CurrForm.UPDATE(FALSE);
After that Go to the Function Name: OnOpen of the Customer Card (ID 21) and put the code
ContBusRel.SETCURRENTKEY("Link to Table","No.");
ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Customer);
ContBusRel.SETRANGE("No.","No.");
IF ContBusRel.FIND('-') THEN
CurrForm.navuser.FORM.SetSubformLines(ContBusRel."Contact No.");
Do the same after the Function OnAfterGetRecord of the Customer card (ID 21);
I think this will work.Now or Never0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
