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:
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
Answers
Thanks in advance
[EDIT]
My main form now has:
and on the subform the function looks like:
And it works, thanks for the feedback ^^
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.