Category: Firebase

MS CRM dynamics with Firebase(using c#)

MS CRM dynamics with Firebase(using c#)

In my previous blog I wrote about how we can use firebase with CRM Dynamics in client side.
Here is the link MS CRM dynamics with Firebase (Using JS)

Today I am going to explain, how we can use Firebase with Plugin or Custom workflow in CRM using C#.

Let’s create a class library and add a class FirebaseWithCRM.cs

For communicate from CRM plugin to Firebase, we use FireSharp. It is a .net library for Firebase Rest Api.

c1

Next we add CRM core assemblies in our Class library project.

c2

We register this plugin on pre-operation event of Account Entity and on create Message ,so whenever new Account is create it ‘ll modify/add Account data in Firebase.

c3

Add new file as FirebaseHelper.cs that contain Push function

c4

c5

But our code is depends on some other DLL like Firesharp, Newtonsoft.Json , System.Net.Http , Microsoft.Threading.Task etc.

So Need to Merge all Dll’s into single one.

c6

What is ILMerge ?

ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output.

For info refer this link

http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx

 

For Merging Dll’s there is a Nuget Package MSBuild.ILMerge.Task so using this package we can merge all DLL’s.

You can also refer this article for more understanding about DLL’s Merge by Nicolas Niwonski.

 

c7

 

c8

After Merging we can deployed this DLL using Plugin Registration tool on pre-operation event for Account Entity and on Create Message.

You can also register on Post-operation event by this we get Guid of account entity and store it in Firebase.

c11.PNG

That’s it Now we can test. 🙂

c9

C10

Now when we create New account it created in Firebase under Accounts Node.

For more synchronous and asynchronous function for Firesharp, please refer below link

https://github.com/ziyasal/FireSharp/wiki/v1-Docs

 

 

Thanks for visiting my blog.

Do some creative stuff in CRM  !!!  🙂

 

Advertisements
MS CRM dynamics with Firebase(using JS)

MS CRM dynamics with Firebase(using JS)

Real-time applications provide so much functionality across so many different types of applications. There’s Google Drive real-time editing, Twitter showing new tweets and so many more.

It’s always good to learn how to make these types of techniques by learning things like socket.io

Today I am going to tell how we can use firebase with MS dynamics CRM and make real time notification model for mobile\web users.

Like status Change ,Create ,Update or some other useful requests that we performed in CRM , we can easily integrate Firebase in all that condition and Sync important data with users .

What is Firebase?

Firebase is an API service to store and sync data in real-time. What this means is that you don’t have to worry about the backend server, database, or real-time component (socket.io). All of that is handled for you by Firebase.

Just grab data from Firebase, save data to Firebase, and Firebase will worry about saving, and also syncing across all connected devices/sites. Piece of cake!

firebase

Let’s integrate firebase in CRM  !!

Before writing any code first we need to make firebase API.

AppName

After successful creating of App we get one URL like https://XXXXXX.firebaseio.com 

For more info about firebase configuration and security Please refer this link

https://www.firebase.com/docs/

What we want is to receive notifications whenever the status of case records changed.

We are using https://mscrmdynamics.firebaseio.com/Cases AppUrl for all firebase operation.For demo you can also use it.

Let write some client side code(JS) on Save Event of Case Form.

Make new Web resource type Jscript and inside it write the code which communicate with firebase on Save Event of case form.

1

In above code I used RequireJs for Injecting Firebase and underscore Scripts. we can also use downloaded files and add them in form.

Whenever status changed we send a json body with Incident(case) attributes like Incident Id, Title, Status ,Owner to Firebase and save it.

We check all case (https://xxxxxx.firebaseio.com/Cases) snapshots on our Apps that sync with our system or mobile Phones. After getting data we made our logic for showing information through notifications.

OK let’s move to the next step, we’ll call the function when record updated with Event mode value  1 or 2 or 70.

For more Information about Save Event Argument please refer Below link

https://msdn.microsoft.com/en-us/library/gg509060.aspx

Before adding/creating new case, we need to check the existance of that case in firebase that this case is not already present and if it exist then we need to update it’s status only.

2.PNG

That’s it. Now we can Sync Case record status with firebase and we can use it’s data for many purposes of sales/services/marketing.

Lets save case with status On Hold .That reflects in firebase, show in below screens

4

5

On changing status of case, it’ll immediately reflects in firebase.

6

7

Here is the link for complete code and video.

http://1drv.ms/1UpKKXo

 

Thanks for visting my blog.

Do some creative stuff in CRM  !!!  🙂