Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SQL Trigger behavior on CRM 2011

(0) ShareShare
ReportReport
Posted on by 145

Hi,

I'm a CRM newbie (but a veteran DBA) and I've gone through the forum and saw time and time again the advice not to use triggers on CRM.

I can understand the logic behind this, but - is there a way to implement a trigger on a base table without getting an annoying CRM application error ?

If not, what solution would you recommend on implementing a trace (to a trace table) updates in such entities as ContactExtensionBase ?

*This post is locked for comments

  • Liran Profile Picture
    145 on at
    RE: SQL Trigger behavior on CRM 2011

    Yes, thank you. I'll investigate the matter further. :)

  • Liran Profile Picture
    145 on at
    RE: SQL Trigger behavior on CRM 2011

    First of all - thank you all for your replies ! :)

    What I need is very simple - I want to capture all updates to the ContactExtentionBase table to a seperate trace table (in another DB on the same server).

    The capture should be performed only if certain columns have been updated.

  • Liran Profile Picture
    145 on at
    RE: SQL Trigger behavior on CRM 2011

    Can I perform this trace using a workflow / plugin ?

  • Liran Profile Picture
    145 on at
    RE: SQL Trigger behavior on CRM 2011

    And yes, I'm aware of the lack of support issue. That's why I'd rather stick to SQL :)

  • Liran Profile Picture
    145 on at
    RE: SQL Trigger behavior on CRM 2011

    Well, this is a puzzle to me as well :)

    The trace table has no constraint and the datatype is correct - I've created it myself. Basically the same code (different names of course) of these two triggers behaves differently.

    If I adjust the 2nd trigger (which works) to update the ContactBaseExtention table to 1 instead of NULL it still works ! but the 1st trigger does not :( I'm quite baffled at this behaviour

  • Community Member Profile Picture
    on at
    RE: SQL Trigger behavior on CRM 2011

    I forgot to mention; what you're doing is unsupported....Just an FYI in case you don't want to void your ability to request support from Microsoft....i.e. every support incident you start will begin by them having you remove all of your non-native database objects (if they accept the case).

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: SQL Trigger behavior on CRM 2011

    Weird, if writing null works but writing getdate() to a Custom trace table column on a different database within the same sql instance doesn't work then I would think that was because of a constraint or data type spec on the tracetable.....I'm assuming you get the same result if you just try to flip a bit field from null to 0 or 1 on the trace table from within the trigger?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans