Where to set default value on Sales Order Subform?

gadzilla1
Member Posts: 316
Hello all,
I've attempted this a number of different ways with no success...
When a user selects 'Resource' as Type in the Sales Order Subform, I'd like the Quantity for that line and that line only to default to 1.
I don't know if my issue is in syntax or placement...any suggestions/samples would be much appreciated!
I'm a newbie but for every 3, 4 issues I figure out there is one that I get stuck with, and this is one. Thanks! Chris
I've attempted this a number of different ways with no success...
When a user selects 'Resource' as Type in the Sales Order Subform, I'd like the Quantity for that line and that line only to default to 1.
I don't know if my issue is in syntax or placement...any suggestions/samples would be much appreciated!
I'm a newbie but for every 3, 4 issues I figure out there is one that I get stuck with, and this is one. Thanks! Chris
0
Answers
-
Hello,
you can add code to the "Sales Line" table, to the Type - OnValidate trigger, something like this:IF (Type <> xRec.Type) AND (Type = Type::Resource) AND ("Document Type" = "Document Type"::Order) THEN VALIDATE(Quantity, 1);
0 -
can't i do that somewhere in the Sales Order Subform?0
-
It's better to put your code on the Table instead of the form.
Is there a reason you prefer the form?0 -
gadzilla1 wrote:can't i do that somewhere in the Sales Order Subform?
You should never put processing code on a form, always in a table or codeunit.David Singleton0 -
Thank you and thank you!
In regards to the 'preference' inquiry, no preference, I'm just new.Thanks - Chris
0 -
I placed everything where suggested above. When I select 'resource' for the type on the sales order, nothing defaults in Quantity...
Shouldn't I now see a '1' in the Quantity field? It's still blank...
I want quantity to be editable, just only to default to '1' when a Type of 'Resource' is selected.
Suggestions? Thanks - CDM0 -
Resource is a type - select resource as type & then enter a resource No and it should change.
I don't use resoucre ever as a type - so I haven't tested it but we do have all our sales lines default to 1 regardless of the type.
Where are you putting the code & are you making a sales order or a sales invoice?
Maybe try something like this....
No. - OnValidate()
IF Type IN [Type::Item,Type::Resource] THEN
VALIDATE(Quantityty,1)
ELSE
VALIDATE(Quantity);0 -
Savatage is correct. Do it on validating No. somewhere after the init0
-
This works great, thanks to all!0
-
Glad to help. Please put [Solved] in the post title0
-
Glad to...thanks again. What is the proper way to do that?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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