OnDatabaseModify trigger in CU 1

genericgeneric Member Posts: 511
Hello
I noticed the new triggers in CU 1. I tried to see how it works and add a
message('testing') on trigger OnDatabaseModify

This is on sql 2009 R2.

The trigger is not working. when I run code to modify a record.

customer.findfirst;
customer.name := 'test';
customer.modify;


why isn't it triggering the code?

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    These functions were created for the Dynamics CRM Connector. See also http://msdn.microsoft.com/en-us/library/gg502491.aspx , Record ID
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • genericgeneric Member Posts: 511
    Thanks for the documentation link, but that link is useless.
    These triggers are called whenever a record changes through code or user interaction.

    I'm trying to find out why the triggers do not trigger :D
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    generic wrote:
    Thanks for the documentation link, but that link is useless.
    That's because you didn't explore that page, but only read one line.

    I'll give it another try: See http://mibuso.com/blogs/mandyk/2011/01/ ... n-2009-r2/
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • mdPartnerNLmdPartnerNL Member Posts: 802
    @Luc, thanks for the interesting blog :)
  • SogSog Member Posts: 1,023
    The trigger is not working. when I run code to modify a record.

    customer.findfirst;
    customer.name := 'test';
    customer.modify;


    why isn't it triggering the code?
    does modify(true) trigger it
    According to the blog it does :)
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • krikikriki Member, Moderator Posts: 9,112
    Like with the OnGlobalXXXX-functions in C1, you first need to do some setup and the first time an action is done on a table, the function GetGlobalTableTriggerMask is called that decides what has to be done in case of an Insert/modify/Delete/Rename of that table.

    So, first you need to do some setup and then do some action on that table. The first time you do an action on a table, the function "GetDatabaseTableTriggerSetup" is called that decides what has to be done in case of an Insert/modify/Delete/Rename of that table.

    BTW: If you are on R2, it is best to use OnDatabase-triggers than the OnGlobal-triggers. The OnGlobal-triggers are NOT triggered if you do an insert from code. The OnDatabase-triggers are (I didn't do any extensive testing on it, but it seamed to me like that).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.