locked
How to write trigger when value of field is updated in MS CRM RRS feed

  • Question

  • Hello All,

    I want to call a service method of my code when a value of field (like contact name) is updated in MS CRM 2011. So how can I write a trigger in MS CRM by which I can call a service method of my code.

    Please help.




    • Edited by JaiHariHar Tuesday, September 3, 2013 10:03 AM
    Friday, August 30, 2013 11:16 AM

Answers

  • A plugin allows you to intercept certain messages at certain points to the system an introduce your own code. For example you can create a plugin on the update message for an entity and have it call custom code prior to or after the record has actually been updated in the database. 

    For example this page walks through registering a plugin to fire when an Account record is created - and executes custom code after the initial save to the database has happened.

    Walkthrough: Register a Plug-in Using the Plug-in Registration Tool

    I'd suggest you walk through this basic sample to better understand what a plugin in does - based on what you are describing I believe it is exactly what you are looking for.

    Sample: Basic Plug-In


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Friday, August 30, 2013 1:23 PM
    Moderator

All replies

  • Hi Utthan,

    You can identify the changes by using isDirty method. If isDirty return true means your field value has updated, so do rest of the stuff.

    Hope this will help you.


    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Friday, August 30, 2013 11:52 AM
  • You can also check out the SDK - specifically this section on plugins if you want to perform some custom action using .NET code on the server side

    Plug-in Development for Microsoft Dynamics CRM

    or this section if you want to handle something on the client side using JavaScript

    Client-Side Programming Reference


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Friday, August 30, 2013 11:54 AM
    Moderator
  • Hi Utthan,

    You can identify the changes by using isDirty method. If isDirty return true means your field value has updated, so do rest of the stuff.

    Hope this will help you.


    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Thanks for the reply but I want an automated trigger like trigger in salesforce that gets fired whenever an update/delete/create on an entity (like account) so that  I can call my .Net code.
    Friday, August 30, 2013 12:43 PM
  • You can also check out the SDK - specifically this section on plugins if you want to perform some custom action using .NET code on the server side

    Plug-in Development for Microsoft Dynamics CRM

    or this section if you want to handle something on the client side using JavaScript

    Client-Side Programming Reference


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Thanks for the reply Jason. I did a small study of Plug-ins for MS CRM, but couldn't understand that how will I come to know in .Net code that the entity record is update or deleted or created in MS CRM ? Please let me know, if you couldn't understand my question. I can write in more detail of my requirement.



    • Edited by JaiHariHar Friday, August 30, 2013 1:08 PM
    Friday, August 30, 2013 1:02 PM
  • A plugin allows you to intercept certain messages at certain points to the system an introduce your own code. For example you can create a plugin on the update message for an entity and have it call custom code prior to or after the record has actually been updated in the database. 

    For example this page walks through registering a plugin to fire when an Account record is created - and executes custom code after the initial save to the database has happened.

    Walkthrough: Register a Plug-in Using the Plug-in Registration Tool

    I'd suggest you walk through this basic sample to better understand what a plugin in does - based on what you are describing I believe it is exactly what you are looking for.

    Sample: Basic Plug-In


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Friday, August 30, 2013 1:23 PM
    Moderator
  • A plugin allows you to intercept certain messages at certain points to the system an introduce your own code. For example you can create a plugin on the update message for an entity and have it call custom code prior to or after the record has actually been updated in the database. 

    For example this page walks through registering a plugin to fire when an Account record is created - and executes custom code after the initial save to the database has happened.

    Walkthrough: Register a Plug-in Using the Plug-in Registration Tool

    I'd suggest you walk through this basic sample to better understand what a plugin in does - based on what you are describing I believe it is exactly what you are looking for.

    Sample: Basic Plug-In


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn


    Thanks. It will take little time to study deeply from the websites (links you provided).
    Friday, August 30, 2013 1:54 PM
  • Thank you so much Jason, it was very helpful.


    • Edited by JaiHariHar Wednesday, September 4, 2013 7:25 AM
    Tuesday, September 3, 2013 10:02 AM