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:
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?
Comments
](*,)
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?
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,
Depro