Populate subform based on header selection
Dneal
Member Posts: 103
Hi All,
I need to have the No. in the sales invoice details populate based on the sell-to-customer in the header. So when the user selects a sell to customer the No. field auto populates.(it will be auto populating based on a field I added to the customer table.)
I'm having trouble with triggers and how to get this to display once the selection is made.
Any tips or ideas would be greatly appreciated.
Thanks,
Dneal
I need to have the No. in the sales invoice details populate based on the sell-to-customer in the header. So when the user selects a sell to customer the No. field auto populates.(it will be auto populating based on a field I added to the customer table.)
I'm having trouble with triggers and how to get this to display once the selection is made.
Any tips or ideas would be greatly appreciated.
Thanks,
Dneal
0
Comments
-
I'd propably start with the onValidate trigger in the header table on the sell-to-customer field.0
-
I've been messing with this for some years ago. Don;t remember exactly how I got it to work. Basicly what happend was that someone added the customer field to the primary key so that is was popupated automaticaly. We changed it back to the orriginal key and got it to work via other triggers. You don;t want to change navision;s keys. O:)
A friend of me asked the same question last week. I'll ask if he got it to work.0 -
The header table has a function called 'UpdateLines' or something like that. Add your custom field to the function and call it from the OnValidate trigger in the Header table.0
-
Thanks for your response. My issue is I can't get the value to display in the subform after the selection has been made in the header. I must be missing something very simple here. Please help.
Dneal0 -
Try CurrForm.UPDATE; in the OnAfterValidate trigger of the header field.0
-
Sorry, I seem to have missread your post. I thougt you wanted to have access to the customer no. when entering a new salesline.0
-
Hi Again all,
Thanks for all the replies. This is what has happened.
I have the following code put in the OnTimer() trigger of the sales details.
IF Customer.GET(xRec."Sell-to Customer No.") THEN BEGIN
"No." := Customer."Default Account";
CurrForm.UPDATE;
END;
I'm not even sure if this is a good idea to do.
But what is happening now is that the only time the NO. field updates in the sales details is when a No. has been selected in the sales details AND I reselect the Sell-to Customer No.
Why doesn't it show right away?
Dneal0 -
No never put any data related code on any form. All of your field validation code should be in the table or in functions elsewhere. Only use any form triggers to display related code. You don't want to use the timer event either, because that refreshes the form and will save the information when you may not be ready to save it yet.
Then the next issue is your use of xRec, why are you using xRec and not Rec?
What do you want to do? When you select a sell-to customer in the Invoice header, you want something on the line to automatically be entered? What do you want to enter automatically? What are the conditions under which this happens? Is this a default value on the Customer Card? There are plenty of field validations in the Sales Header validation that flow through to the line detail that you can take a look at, like Location Code for instance.0 -
Thank you for information.
This is what needs to happen.
To reduce data entry for the customer we have defaulted some of the values in the sales invoice details. The Type is to = G/L Account, the quantity = 1 and the No = the G/L account number on the customer(On the Customer card is a new field that contains a G/L account number.
When a new record is created I have this code on the OnNewRecord of the details subform:
Type := xRec.Type::"G/L Account";
Quantity := 1;
I used xRec because the existing code was using xRec.(I made the assumption I should use it, and just kept using it. :oops: )
When a sales invoice is created and the user selects the Sell-To Customer and they want to see the G/L account number for the customer to appear in the existing No. field of the subform. Here is where I'm running into issues. It would even be acceptable if the user were to click or tab over the type field. But I'm having issues with getting this to display as well.
I really would appreciate some guidance here. I apologize for my lack of understanding of the triggers.
Dneal0
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
- 327 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

