UCMA – I’m Writing a Message

I was working on a UCMA (Unified Communications Managed API) issue the other day and wanted to integrate the “Is Writing a message” functionality that is oh so important in any chat conversation today.  My application is pretty simple, a chat bot is listening to incoming requests and directing them to their intended recipient.

You can see this in some of the built in examples, but if you haven’t looked there yet, this functionality is quite easy to implement.

In your MessageReceived event from your Message Flow, simply add the following line into the event before you send back your reply and this will trigger an event to fire when this occurs.

MessageFlow.LocalComposingState = ComposingState.Composing;

And that’s it, now you can know when the receiving user start to type a response, even when they take a pause only to have it fire again.

 

Dynamics Workflow Scope

I ran into a scenario this week, where  workflow I created was only running for my user account on records that I had created and not ones that I might later modify and/or that other people had created.

The solution was to change the scope of the workflow to Organization so it ran for everyone.

Changing from User (the default) to Organization got this going.  I haven’t had a need to try with the current user’s business unit which would be pretty cool too.

org

Alternate Keys in Dynamics

In CRM 2015 Update 1, a new concept for allowing a field to be listed as a primary key outside of the traditional Guids was introduced called Alternate Keys.  I had not had a chance to use this feature in-depth so thought this would be a great opportunity to dig into it.

The concept itself is pretty simple – you are integrating Dynamics with another system that has it’s own setup of Primary Keys why not replicate those Ids in Dynamics.  If you are deploying a greenfield solution with no integrations to other systems, you’ll probably never use this feature.  However, if you have a complex synchronization solution between many line of business solutions where an entity in Dynamics could actually represent 5 disparate resources throughout the rest of your organization, this could be a big win for you.

Creating an Alternate key is pretty easy and can be done from the entity section in Dynamics.

key1.PNG

From here you then identify your field as an alternate key in the new “keys” section of your entity.

key2

Which will then show as an alternate key in the Keys section.

Key3

Without any other configuration, your new “key” field automatically has Duplicate data detection on it, ensuring that each record has a unique value as a key within it.  If a duplicate value is identified, the following warning is presented to the user.

key4

As someone who writes migration/syncing code quite a bit, this is a great way to manage a variety of keys from different environments and ensure data is not getting dirtied.  There are some additional SDK functions that enable you to create entities from the alternate key as well.

My only confusion with this feature was that when you mark the field as “an Alternate Key” it doesn’t make it Business Required by default.  As a unique key, allowing empty values (even one should not be allowed).