Common plugin for Deactivate / Delete all associated entity

Its walk-through for deactivating all associated (1:N) records. Steps for that are

  1. Create plugin
  2. Register and create steps

Create plugin

Continue reading “Common plugin for Deactivate / Delete all associated entity”

Trigger plugin using Action

actions

There are many scenarios that we needs to trigger plugin from ribbon / command bar. For this kind of scenario what we do, we create dummy entity and then call some message from JavaScript of  that dummy entity to trigger our plugin (you can explore this example from here ). This is what we do for MS CRM 2011, but from MS CRM 2013 onward, Microsoft CRM introduced ‘Action’ process.

Using Action we can trigger plugin, steps for that are …

Continue reading “Trigger plugin using Action”

MS CRM Plugin debugging

top-debugging-tips

To debug plugin, we have two ways, One is explained in below provided link, I will explain the other.

https://support.microsoft.com/en-us/kb/2778280

Continue reading “MS CRM Plugin debugging”

Date Time in MS CRM

Date-time conversion to local ….

Using the SOAP endpoint, you will always get a UTC date, to get into a local date on a client (assuming that the client has their datetime set correctly) use DateTime.ToLocalTime, but if you can’t guarentee the time zone settings then use ..

Continue reading “Date Time in MS CRM”

Add Attachments to Entity

ath

Attaching file in MS CRM through coding ,

Many times we needs to add different documents as an attachments to note, thus thought to share it ..

I explored, PDF, Word, Excel, Text file only, but i belive same code can be useful for other types of documents as well. Thus only Text file and PDF file complete function ahs been provided as an example and for rest only change of that document. That change belongs to  “mimetype”   only, rest part is same.

Word file : only change mimetype in below PDF code

// Set the type of attachment
note.MimeType = @"application\ms-word";

Continue reading “Add Attachments to Entity”

Consume web service from plugin

web

Many times, during our MS CRM development we needs to interact with other application, we called it ‘integration’, we have multiple ways for it

  1. we can write stand alone application for it, which will interact both the application
  2. consume web service or open same for outside world etc …

First of all, make sure that provided sample SOAP is working fins with provided end points, so it will save your lots of efforts, you will get plenty of applications over the net. I used used one of it, you may use it by downloading it from here. This application looks like below,

Continue reading “Consume web service from plugin”

Linq query on EntityCollection

linq

Querying SQL database all the time may affect performance so some time we can pull the generic data and then query on that result collection may give better result.

Here is the example of it,

Continue reading “Linq query on EntityCollection”

Common duplicate detection rule

dup

In MS CRM we have duplicate detection rule to detect duplicate entity records, but it will give you a simple popup (ref below screen), but it not stops you to create duplicate.

But many times we needs a hard stop for duplicate, we can achieve this by writing simple plugin, that will be reusable for any entity. Here is the sample of it

Note: I assuming that name is unique here. but it can modified with some other or more attributes

Continue reading “Common duplicate detection rule”

Sharing Records using a Workflow

We can not share records directly form out of box workflow, but by writing little code, its possible. That code with workflow is available on codeplex for free here are the links …

http://crm2011sharestep.codeplex.com/

http://crm2011workflowutils.codeplex.com/

In both of these plug-ins, an option to ‘share’ was produced as a step when creating your workflow. When the step is selected you are then able to select with whom (user or team) the record is to be shared with and what the default share permissions should be (e.g. read, write, delete). Similarly, you can have the step configured to remove all sharing or sharing with a specific user.