BC SaaS: Add custom code at inserting new record in table Sales Header

DamjanDamjan Member Posts: 92
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".
cy1eatb083s9.png

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

Best Answer

Answers

  • SanderDkSanderDk Member Posts: 436
    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 available
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • DamjanDamjan Member Posts: 92
    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?
    3s1y0vlj6hmo.png
  • mohana_cse06mohana_cse06 Member Posts: 5,474
    Answer ✓
    there is another event called "OnBeforeInitInsert". Please use that.
  • DamjanDamjan Member Posts: 92
    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.

Sign In or Register to comment.