Set Job Task No. with extension

AitorEG
Member Posts: 342
Hi everyone,
I'm finding a problem finding the event where I can set the "job Task No." before the insert of the registry.
In a job card, when I'm trying to create a Job Task, I want to create it without setting the Job Task No, which I want to be filled when inserting, adding for example, the date. Which event can I sue fro this purpose? I'm trying to use the events from the "Job Task" table, but I can't find the correct way.... Is possible to develop this with extensions?
Thank you very much
I'm finding a problem finding the event where I can set the "job Task No." before the insert of the registry.
In a job card, when I'm trying to create a Job Task, I want to create it without setting the Job Task No, which I want to be filled when inserting, adding for example, the date. Which event can I sue fro this purpose? I'm trying to use the events from the "Job Task" table, but I can't find the correct way.... Is possible to develop this with extensions?
Thank you very much
0
Comments
-
Ok, than you want to set it when the user set the Job Task date, right? What about the OnAfterValidate event on the table, for the Date field?0
-
Well, the issue is the next.
In the job card, I try to create a new line. I don't fill the "JobTaskNo", and when NAV tries to insert the new registry, I get the error, telling that I must fill the JobTaskNo. So, I think that the best event should be "OnbeforeInsertEvent", and i coded like this:[EventSubscriber(ObjectType::Table, Database::"Job Task", 'OnBeforeInsertEvent', '', true, true)] local procedure setJobTaskNo(VAR Rec: Record "Job Task") begin if Rec."Job Task No." = '' then begin Rec."Job Task No." := '123456'; Rec.Modify(); end; end;
But I still having the same issue, probably because i am using "Rec", and this rec doesn't exist, because the insert is not done yet...0 -
Try removing the Rec.Modify, if for your situation the event is correct, this should solve your issue0
-
Ok, the issue could be caused by "manually permitted" setted to false on Job Task no. Series.
Try to set it to false and check if this solve the issue0 -
Same problem again...
I've simplified the code like this, just to show a message in the event:[EventSubscriber(ObjectType::Table, Database::"Job Task", 'OnBeforeInsertEvent', '', true, true)] local procedure setJobTaskNo(VAR Rec: Record "Job Task") begin Message('aitor'); end;
But the error notification appears before my message, so, the validation is made before the "OnBeforeInsertEvent"...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