Assign Dimensions OnInsert Record

depro
Member Posts: 46
Guys,
I need to assign "Selesperson Code" and corresponding salespersons default dimension values to job when inserting record in Job table.
I wrote code like this in OnInsert trigger:
In OnValidate trigger i put this code:
ValidateShortcutDimCode function is standart Job Table function with code:
But when i try to insert new record to Job Table error message appear:
"Job No. XXX does not exist"
How can I avoid inserting record to Defoult Dimension Table before I inserted record to Job Table?
I`ve tried to use Insert in OnInsert trigger but it doesnt make sense, becouse of double inserting the same record.
Using temporary table to store my default dimension seems to be good solution but how can I retrive this record after inserting Job record?
Any ideas or suggestions?
I need to assign "Selesperson Code" and corresponding salespersons default dimension values to job when inserting record in Job table.
I wrote code like this in OnInsert trigger:
recSalesperson.SETRANGE("User ID",USERID); IF (recSalesperson.FINDFIRST) THEN VALIDATE("Salesperson Code",recSalesperson.Code);
In OnValidate trigger i put this code:
FOR i:=1 TO 8 DO BEGIN IF recDefaultDim.GET(DATABASE::"Salesperson/Purchaser", "Salesperson Code", GLSetupShortcutDimCode[i]) THEN ValidateShortcutDimCode(i, recDefaultDim."Dimension Value Code"); END;
ValidateShortcutDimCode function is standart Job Table function with code:
ValidateShortcutDimCode(FieldNumber : Integer;VAR ShortcutDimCode : Code[20]) DimMgt.ValidateDimValueCode(FieldNumber,ShortcutDimCode); DimMgt.SaveDefaultDim(DATABASE::Job,"No.",FieldNumber,ShortcutDimCode); MODIFY;
But when i try to insert new record to Job Table error message appear:
"Job No. XXX does not exist"
How can I avoid inserting record to Defoult Dimension Table before I inserted record to Job Table?
I`ve tried to use Insert in OnInsert trigger but it doesnt make sense, becouse of double inserting the same record.
Using temporary table to store my default dimension seems to be good solution but how can I retrive this record after inserting Job record?
Any ideas or suggestions?
0
Comments
-
Or mayby this is impossible?
](*,)0 -
Why wouldn't you assign the salesperson dimension and value against the job card?
The dimension will then be inserted against the ledger entries anyway ????
If you have different sales people, enter the salesperson against the job task lines instead?0 -
hi jannestig!
Our client use Job Card as type of Transport Order.
They aren`t use Job Task Lines.
The reason why they use Jobs is to move dimension Value form Job Card to sales/purchase documents and to entries table.
Using Jobs you can also accumulate all costs and profits according specific transport order.
Jobs has that kind of funcionality so we use that part of standart NAV and accomodate it to customer needs.
But next problem is that customer have to create a lot of transport order every day,
so my objective is to make filling Job card as fast and easy as possible.
I just wont to minimize no. of filelds to inserting data.
Besides this users often forget to put Dimensions Codes.
Regards,
Depro0 -
Check the standard dimension and dim. value functionality for items and how it is used when inserting items into sales lines.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