Running function is header skipping function in line.

tabularasa
Member Posts: 22
Hello everyone.
I have a function that I run from the onDelete trigger of the sales header. It asks the user if some tasks should be performed and then performs these.
I have a similar function in the sales line in th OnDelete trigger which performs similar function, asks the user and then performs a subset of the header function.
My problem is that I don't want the Function in the Sales Line to run when the sales Header is deleted. I have tried.
1. Using the Currfield function and setting the condition if Currfield <> 0 then SalesLineFunction
2. Creating a variable in the sales Line Form (page) that calls a function in the sales line that assigns a global variable. The problem is that immediately after that function is done the global variable is reverting to opposite value.
Any ideas.
Many thanks ..
I have a function that I run from the onDelete trigger of the sales header. It asks the user if some tasks should be performed and then performs these.
I have a similar function in the sales line in th OnDelete trigger which performs similar function, asks the user and then performs a subset of the header function.
My problem is that I don't want the Function in the Sales Line to run when the sales Header is deleted. I have tried.
1. Using the Currfield function and setting the condition if Currfield <> 0 then SalesLineFunction
2. Creating a variable in the sales Line Form (page) that calls a function in the sales line that assigns a global variable. The problem is that immediately after that function is done the global variable is reverting to opposite value.
Any ideas.
Many thanks ..
0
Comments
-
You should not be asking questions in the ondelete trigger. Think of a different way to do this and redesign your logic. Since you have not explained what you are doing its hard to give guidance though on how to redesign it.David Singleton0
-
Don't create a variable in the form, create it in the sales line table, where your function is in the OnDeleteTrigger.
Create a SetParameter Function in SalesLine. Only run your function in case the parameter is true/false.Frank Dickschat
FD Consulting0 -
Basically there are entries linked to the sales header and the sales lines. The sales invoice was created based on the value of these entries. When the invoice is deleted the status of these entries should be reverted to it's former state if the user confirms that as sometimes he might not want that.0
-
FDickschat wrote:Don't create a variable in the form, create it in the sales line table, where your function is in the OnDeleteTrigger.
Create a SetParameter Function in SalesLine. Only run your function in case the parameter is true/false.0 -
in the setparameter, you can declare a temporary table of subtype "integer" and insert a dummy record in it...
then, check if the record is present. It should work.
BTW: don't ask for user interactions in ondelete/insert/modify triggers, if possible...and try to not code under the form, but just under the table, if it is suitable for your business logic.0 -
Many thanks I'll try this. I always try to leave the forms for coding and keep it to the table. But this seemed like a last resort. Not sure how to avoid asking the customer through function triggered from the ondelete trigger As the business logic is to modify related entries when the sales invoice is deleted.0
-
This worked Many Thanks.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