GuiAllowed - stop pop up message for dimensions when creating Job from AL

samantha73
Member Posts: 118
Hi All
I'm still struggling to stop pop messages when creating a Job from code, where a user clicks an action button on quote screen and it creates a Job. Pop up message appear as usual for copy dimensions to tasks
I've initiated the Job and written below code
Looking at the base table Job there is a piece of code that I think creates the pop up below
Couldn't find any function with HideDialog to pass a false so what options do I have? One is not to validate and try to code the whole validation thing but I might miss something or worse if the base code change in an upgrade might not do the right validation
I'm still struggling to stop pop messages when creating a Job from code, where a user clicks an action button on quote screen and it creates a Job. Pop up message appear as usual for copy dimensions to tasks
I've initiated the Job and written below code
Job.Validate("Global Dimension 1 Code", SalesHeader."Shortcut Dimension 1 Code"); Job.Validate("Global Dimension 2 Code", SalesHeader."Shortcut Dimension 2 Code");
Looking at the base table Job there is a piece of code that I think creates the pop up below
local procedure UpdateJobTaskDimension(FieldNumber: Integer; ShortcutDimCode: Code[20]) var JobTask: Record "Job Task"; IsHandled: Boolean; begin IsHandled := false; OnBeforeUpdateJobTaskDimension(Rec, FieldNumber, ShortcutDimCode, IsHandled); if IsHandled then exit; if GuiAllowed then if not Confirm(UpdateJobTaskDimQst, false) then exit; JobTask.SetRange("Job No.", "No."); if JobTask.FindSet(true) then repeat case FieldNumber of 1: JobTask.Validate("Global Dimension 1 Code", ShortcutDimCode); 2: JobTask.Validate("Global Dimension 2 Code", ShortcutDimCode); end; JobTask.Modify(); until JobTask.Next() = 0; end;
Couldn't find any function with HideDialog to pass a false so what options do I have? One is not to validate and try to code the whole validation thing but I might miss something or worse if the base code change in an upgrade might not do the right validation
0
Best Answers
-
There's a OnBeforeUpdateJobTaskDimension event publisher with an IsHandled parameter. You could set IsHandled to true in an event subscriber and make it exit out of the UpdateJobTaskDimension function. If you use Job Tasks, you need to copy the code in the UpdateJobTaskDimension function into the event sub and leave out the confirmation message0
-
Guiallowed is a system flag, it indicates whether GUI elements can be shown. It is true when running the web client (or windows client in the NAV days), false for background sessions. You can’t set it in code, you can’t set it to false from the web client for instance
Not sure what you mean by ‘something better’, it is what it is. You’re lucky that this function has an IsHandled flag, not all of them do0
Answers
-
There's a OnBeforeUpdateJobTaskDimension event publisher with an IsHandled parameter. You could set IsHandled to true in an event subscriber and make it exit out of the UpdateJobTaskDimension function. If you use Job Tasks, you need to copy the code in the UpdateJobTaskDimension function into the event sub and leave out the confirmation message0
-
Perfect that worked..what this means is you cannot set GuiaAllowed and the only way to control this is either integration event or creating your own code. I guess if you are creating documents from an API call or Job queue GuiAllowed = false . Perhaps MS will come up with something better in a future version0
-
Guiallowed is a system flag, it indicates whether GUI elements can be shown. It is true when running the web client (or windows client in the NAV days), false for background sessions. You can’t set it in code, you can’t set it to false from the web client for instance
Not sure what you mean by ‘something better’, it is what it is. You’re lucky that this function has an IsHandled flag, not all of them do0 -
You can launch your process in a second sesion so it don't show any messsages: STARTSESSION(........)
This won't show any messages, confirms, etc.1 -
You can launch your process in a second sesion so it don't show any messsages: STARTSESSION(........)
This won't show any messages, confirms, etc.
True, because that starts a background session, and GuiAllowed is false there. However it also starts a new and independent transaction and I'm not sure if that is a good idea for a simple field validation. Those background sessions are supposed to be background tasks, I would not use them like this0
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