Inserting Sales Order when form + subform non-editable

Richard_Hensby
Member Posts: 10
Hope someone can help with this....
I have set the Sales Order form and subform to be editable only when the order is open. To achieve this I call the following SETEDITABLE function
IF Status = Status::Open THEN BEGIN
CurrForm.EDITABLE := TRUE;
CurrForm.SalesLines.EDITABLE := TRUE;
END ELSE BEGIN
CurrForm.EDITABLE := FALSE;
CurrForm.SalesLines.EDITABLE := FALSE;
END;
I call it from
ONAFTERGETRECORD
ONOPENFORM
Code that releases the orders
Code that Re-opens released orders.
It works great.
BUT when a released order is on the form, pressing F3 to insert a new order has no effect.
How can I protect non-open orders from being changed, allow users to see these on the same form AND allow users to insert a new record when they happen to have a released record on display ?
NB I don't really want to have to set each field to editable and non editable. Also don't want to block it at the ONMODIFY trigger as this really too late.
I have set the Sales Order form and subform to be editable only when the order is open. To achieve this I call the following SETEDITABLE function
IF Status = Status::Open THEN BEGIN
CurrForm.EDITABLE := TRUE;
CurrForm.SalesLines.EDITABLE := TRUE;
END ELSE BEGIN
CurrForm.EDITABLE := FALSE;
CurrForm.SalesLines.EDITABLE := FALSE;
END;
I call it from
ONAFTERGETRECORD
ONOPENFORM
Code that releases the orders
Code that Re-opens released orders.
It works great.
BUT when a released order is on the form, pressing F3 to insert a new order has no effect.
How can I protect non-open orders from being changed, allow users to see these on the same form AND allow users to insert a new record when they happen to have a released record on display ?
NB I don't really want to have to set each field to editable and non editable. Also don't want to block it at the ONMODIFY trigger as this really too late.
Richard Hensby
Application Specialist
Infinity Solutions
Application Specialist
Infinity Solutions
0
Comments
-
Maybe instead of disabling whole form, you just prevent changes using OnModifyRecord() trigger on form ?®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Good suggestion Robert!
Another method (not quite "standard") would be to create a new menu-item on the main form which creates a new record in the table and the put the short-cut key F3 to that menu-item!Best regards
Tommy0 -
Tommy Schou wrote:Good suggestion Robert!
Another method (not quite "standard") would be to create a new menu-item on the main form which creates a new record in the table and the put the short-cut key F3 to that menu-item!
Thanks Tommy, I like this.
What code do I need to put behind the menu-item to create a new record and display it on the form.Richard Hensby
Application Specialist
Infinity Solutions0 -
IF Status = Status::Open THEN BEGIN
CurrForm.EDITABLE := TRUE;
CurrForm.SalesLines.EDITABLE := TRUE;
END ELSE BEGIN
CurrForm.EDITABLE := FALSE;
CurrForm.SalesLines.EDITABLE := FALSE;
END;
Maybe I am missing something, but reading your code it looks like you are stopping the used from making any amendments to the sales header and line forms ???
Standard attain (AKA MBS- Navision Edition) functionality stop this from happening anyway ??? If I remember right, the user gets an error message about the order not being open and no modifications can be made ????
Is this not the same end result ?Remember: Keep it simple0 -
Dean Axon wrote:
If I remember right, the user gets an error message about the order not being open and no modifications can be made ????
Is this not the same end result ?
This only happens for certain fields and actions.
The requirement that my customer has is for the whole order header and order lines to be non-editable once released. So the code I have implemented achieves this but leaves them without the ability to hit F3 to insert a record.
Now all I need to know is what code F3 executes so that I can put it behind a new button.Richard Hensby
Application Specialist
Infinity Solutions0 -
I have added a button called New Order.
Behind it I have the code
CLEAR(rec);
rec.INIT;
This seems to mimic the F3 to insert new record logic.
Anyone see any problems with this code?
RegardsRichard Hensby
Application Specialist
Infinity Solutions0 -
To insert a new order when a released order is on the form, you must make an function and assign her F3.Richard Hensby wrote:Hope someone can help with this....
I have set the Sales Order form and subform to be editable only when the order is open. To achieve this I call the following SETEDITABLE function
IF Status = Status::Open THEN BEGIN
CurrForm.EDITABLE := TRUE;
CurrForm.SalesLines.EDITABLE := TRUE;
END ELSE BEGIN
CurrForm.EDITABLE := FALSE;
CurrForm.SalesLines.EDITABLE := FALSE;
END;
I call it from
ONAFTERGETRECORD
ONOPENFORM
Code that releases the orders
Code that Re-opens released orders.
It works great.
BUT when a released order is on the form, pressing F3 to insert a new order has no effect.
How can I protect non-open orders from being changed, allow users to see these on the same form AND allow users to insert a new record when they happen to have a released record on display ?
NB I don't really want to have to set each field to editable and non editable. Also don't want to block it at the ONMODIFY trigger as this really too late.0 -
Joachim Schäffer wrote:To insert a new order when a released order is on the form, you must make an function and assign her F3.
How do I assign F3 to a function?
RegardsRichard Hensby
Application Specialist
Infinity Solutions0 -
How do I assign F3 to a function?
You create a new menu-item. Put F3 on the item as a short-cut and then you put something like this on the "OnPush"-trigger of the menu-item:CLEAR(Rec);; INIT; "Document Type" := "Document Type"::Order; INSERT(TRUE); CurrForm.EDITABLE := TRUE;
That should do it.Best regards
Tommy0
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