Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Crm to Azure ServiceBus Event Receiver, cant find what property that has been updated

Posted on by Microsoft Employee

This is a compact version, please ask if you need clarifications:

I have managed to register an endpoint so that when I update a property (for example phone number) in Dynamics CRM Online a message is sent to Azure Service Bus (topic and/or queue, no difference here). I also have a webjob that listens to theses changes, using the signature below:

public static void ProcessTopicMessage([ServiceBusTrigger("my-crm-topic", "topic-subscription1" )] BrokeredMessage pQueueItem, TextWriter log)
{
   RemoteExecutionContext package = pQueueItem.GetBody<RemoteExecutionContext>();

   if(package.MessageName == "Update")
   {
      Entity entity = pPackage.InputParameters["Target"] as Entity;            
      var newPhone = entity.GetAttributeValue<string("telephone1");    

   }

...

}

This works ok, when I change for example phone number I can read the new phone number and all other properties are null. HOWEVER, I cant find any information on the name/id of the property/properties that were changed (except that they are not null).

I could loop through all property names and be happy with that, but the main problem is that there no way to know if the property was set back to null from something else.

I cannot find any indication of that its the phone number that has been changed in pQueueItem- or package-properties. Where do I find it?


   

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Crm to Azure ServiceBus Event Receiver, cant find what property that has been updated

    You are my hero :), I didnt check there, just indexed with property names that I knew of. As you pointed out, the Attributes-array contains the updated property/ies, along with four properties that always are there. Thanks a bunch!

  • Verified answer
    Georgy Profile Picture
    Georgy on at
    RE: Crm to Azure ServiceBus Event Receiver, cant find what property that has been updated

    Hi,

    in your "target" entity, (Entity entity = pPackage.InputParameters["Target"] as Entity)

    you have collection of attributes. Those are the only attributes that were changed (either set to null or initialized with some value). Looping through this collection would provide you with what you need.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans