BC SaaS: Add custom code at inserting new record in table Sales Header
                
                    Damjan                
                
                    Member Posts: 94                
            
                        
            
                    Hi All,
I am working with BC SaaS.
I would need to change the standard code of table "Sales Header" as new record is being inserted, where I need to modify the code that inserts the "No." value of table "Sales Header", so Numbering series.
I noticed that if I add my code in trigger OnInsert of table "Sales Header", it does not work, since numbering series has already been defined in the local procedure "InitInsert".

When I add my code inside trigger OnInsert all the code is being run before my code is executed. How can I place the code before local procedure InitInsert is called? I know I would use Event Subscriber, Publisher, in onPrem, but since this is SaaS version, I am lost a little bit.
Thank you
                I am working with BC SaaS.
I would need to change the standard code of table "Sales Header" as new record is being inserted, where I need to modify the code that inserts the "No." value of table "Sales Header", so Numbering series.
I noticed that if I add my code in trigger OnInsert of table "Sales Header", it does not work, since numbering series has already been defined in the local procedure "InitInsert".

When I add my code inside trigger OnInsert all the code is being run before my code is executed. How can I place the code before local procedure InitInsert is called? I know I would use Event Subscriber, Publisher, in onPrem, but since this is SaaS version, I am lost a little bit.
Thank you
0                
            Best Answer
- 
            there is another event called "OnBeforeInitInsert". Please use that.
0 
Answers
- 
            Why do you thinking you cannot use a eventsubscriper on a BC cloud? It is the only way of doing development on a cloud.
Depeding on WHEN you wants your code to be executed either you can crated an eventsubscriper on either:
OnBeforeInsertEvent
Or
OnBeforeInitInsert
Both is availableFor help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.0 - 
            Hi SenderDK,
So, I have already finished with my custom code, and now I would like to add this code into the CU, so that I can call that CU from as user creates new sales document (sales quote, sales order).
Is this the right place and event?
0 - 
            there is another event called "OnBeforeInitInsert". Please use that.
0 - 
            Hi Mohana_cse06,
sorry for late reply.
I have developed custom numbering series of issued documents per customer. so every document that is issued to a known customer, gets the numbering series specially designed for customer.
thanks for the tip, it helped me a lot.
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
 - 323 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
 

