Wednesday, 11 May 2016

Overview of Plugin

A plug-in is custom business logic written in .NET that can integrate with Microsoft Dynamics CRM. Using plug-ins, you can fire a custom action or event on any entity
Plug-ins are set of events and run when any associated events occur. These events occur on specific condition without any user interface.


Microsoft Dynamics CRM Online, plug-ins must be registered in the sandbox.


Stages

You can set up plug-ins in the pre-stages (either pre-validation or pre-operation) or post-stages (postoperation):

Pre-Stage—Sends control to the plug-in before the real event is executed in the core system.
For example, you might attach a plug-in to the Create event of the Account entity; your code
would execute before the Account was actually created in the CRM system. With this method,
you could prevent the Account or the entity record from being created.

Post-Stage—Executed after the real event has executed in the core system. So, following the
example just described, your code would be executed only after the Account record has been
created.

These stages are participate in SQL transactions as well. So, one can use the pre-stage outside or inside a transaction, and you can do the same for the post-stage.

              The concept of using transactions now allows the rollback of a plug-in operation. If you have two different plug-ins attached to the same message of an entity and the second plug-in fails, it can now roll back the successful operation performed by the first plug-in.

           To check whether the plug-in is running in a transaction by checking the IsInTransaction property of the IPluginExecutionContext.

 The stages 20 (preoperation) and 40 (post-operation) are the ones that guarantee to be part of a transaction, whereas the 10 (pre-validation) might not be part of it.


=======================================================

Deployment Types

A plug-in in three different ways:
Server—Means that the plug-in will execute on the server. Execution will occur when users
use the web client or the Outlook Online client as well as when any workflow is executed.
Offline—Means the plug-in executes on the client’s user machine where Outlook is running.
This proves especially useful when running the Outlook client in offline mode.
Both—Executes the plug-in on the server and in the Outlook client in offline mode. Keep in
mind that the plug-in would be executed twice, once when Outlook is offline and again when it
connects to the server.
Tip
To prevent the plug-in from executing twice because of synchronization, check the
IsOfflinePlayback property of IPluginExecutionContext.

Wednesday, 4 May 2016

Marketing Lists

It helps to create lists of potential customers or existing customers for marketing purposes. There are two types of list:

Dynamic Marketing List is to return a list of members dynamically when needed, based on search criteria you set.  Whenever a new record is created or updated and meets the criteria of the marketing list query, it will automatically be added to the marketing list.


Static Marketing List is used to add and update members manually.

A marketing list can only contain members from one of the following record types: Lead, Contact, or Account. You cannot have members from two different record types in one list.


Create a marketing list

  1. Go to Marketing > Marketing Lists





  2. Click New.
  3. In Summary area, Fill required fields and add or change the information.
  4. Click on Save.

Add members to a marketing list

1. In any marketing list record, in the Members area, click the Add button.


2. Manage Members dialog box displayed, select one of the following options, and then click Continue.


3. Select desired records and click add, Members will be added to marketing list. 

4. Add  campaign or quick campaign which you want to associate to newly created marketing list.







Monday, 18 April 2016

Microsoft Dynamics CRM browser support

Microsoft Dynamics CRM 2013 supports the following web browsers:


  • Internet Explorer 8, 9, 10, and 11
  • Mozilla Firefox—latest publicly released version*
  • Google Chrome—latest publicly released version*
  • Apple Safari—latest publicly released version**

* Both Mozilla Firefox and Google Chrome are supported only if they are running on Windows 8, Windows 7, or Vista (or Nexus 10
tablet for Google Chrome).
** Apple Safari is supported only if it is running on Mac OS X 10.7 (Lion) or 10.8 (Mountain Lion).

Google Chrome is one of the fastest at initial page rendering.

Portable Business Logic (PBL)—Business Rules

Previously  to customize a form and display an error message or show and hide a field,  JavaScript t was used to make it work. With PBL, you can do it without any JavaScript!
The following actions are available with PBL:

  • Show error message
  • Set field value
  • Set business required
  • Set visibility
  • Lock or unlock field
Business rules provide an easy declarative way to consistently evaluate the business logic on both client and server, without the need to write code.


To create or edit PBL, navigate to the customization of the form and select Business Rules on either
the UI or on the solution navigation.

Business Process Flows (BPFs)

A business process flow lets you create more efficient and streamlined sales, service, and other business processes. Having high performing processes in place will help you to increase your win rates, improve customer satisfaction, and grow your revenue.

Users are guided through various stages of the sales or customer service processes. At each stage, you complete specific steps and then move to the next stage. You can customize the process flow by adding or removing steps, changing the order of the stages, or adding new entities to the process flow.




The process flow will tell you where you are in the process, where you came from, and what to do next. You are able to continuously monitor your own progress.

BPFs can be used on the following entities:
Account
Appointment
Campaign
Campaign Activity
Campaign Response
Competitor
Contact
Email
Fax
Case
Invoice
Lead
Letter
Marketing List
Opportunity
Phone Call
Product
Price List Item
Quote
Recurring Appointment
Sales Literature
Order
User
Task

Team

In case of Custom entities, the Business Process Flows (Fields Will Be Created) option must be selected.




Key benefits of BPFs include the following

  • BPFs allow organizations to define the specific steps that need to be taken for something to happen.
  • BPFs allow organizations to track where in the process the record is.
  • BPFs allow for “stage-gating,” which requires data to be entered before proceeding to the next step.
  • BPFs are visually represented on the record.
  • BPFs can be controlled through portable business logic (PBLs) and workflow. An example of this is when a field is hidden via a PBL or a value is populated via a workflow, the BPF incorporates this change as well.
  • BPFs allow for multiple entities in the BPF (up to five).
  • There can be 10 active BPFs per entity.
  • Users with appropriate security permissions can edit the BPF in real time to incorporate new rules.
  • Users can switch BPFs midstream to new BPFs if the situation changes. A common example of this is when an inbound call creates a case with a Case to RMA (Return Merchandise Authorization) process, but it turns out the user just has a question; in this case, the user might change the BPF to Case to KB (Knowledge Base).

Limitations:

  • An entity once selected during design of the BPF cannot be referenced again (except to close the record), and no more than five entities can be referenced.
  • If a user’s security permission does not allow using a BPF, the BPF will be visible but disabled.
  • A maximum of 10 BPFs per entity can be active. (You can have more, but only 10 can be active.)
  • There is a maximum of 30 states per BPF.

System business process flows

Microsoft Dynamics CRM includes the following business process flows. 
  • Lead to Opportunity Sales Process
  • Opportunity Sales Process
  • Phone to Case Process
“Ready-to-Use” BPFs
Microsoft has included a package of 12 other BPFs in the system, but they need to be deployed. To deploy them, navigate to Settings, Data Management and select Add Ready-to-Use Business.


To make new BPF one must has the Manager, Vice President, CEO-Business Manager, System Administrator, or System Customizer security role or equivalent permissions.


Thursday, 10 December 2015

All about Plugins

Q. What is Execution Order in Plug-in Registration tool?


Execution order in plugin specifies the order in which plug-ins are executed within a pipeline stage. Plug-ins registered with an order value of 1 are executed first, followed by plug-ins registered with an order of 2, and so on. However, if there is more than one plug-in in a stage with the same order value, then the plug-in with the earliest compilation date is called first



What is the difference between PreImage, PostImage, Target Entity?

In a plug-in there are potentially several ways to access entity data relevant to the plug-in action. For example, on the create message you can access the data on the new entity instance in one of the following ways:
  1. Via the Target InputParameter
  2. Via an Image Entity registered on the step
Via a Retrieve request in the plug-in code


Availability of the data by stage
The general rules are:
1.       InputParameter is available in all stages. It can be modified in the pre-stage, but changing it in the post-stage will have no effect
2.       A PostImage Entity is available in the post-stage, and a PreImage Entity in the pre-stage only
3.       If using a Retrieve in the plug-in, then the data returned depends on the stage. In the pre-stage, you will see the data before the modification, whereas in the post-stage you see the data after the modification
4.       Some Image Entities are not relevant for some messages - e.g. there is no PreImage for a Create message, and no PostImage for a Delete message




1. All the plug-in events are first stored in  variable called “Target”.
Target  entity available on all steps and contains entity passed in the request message. Target entity can update on Pre-stage and those changes will be post into the database. Changes on Post-stage don’t affect database.

2. Pre-image, you get the image of the record as is stored in the SQL database before the CRM Platform action has been performed.
Post Image, returns the image of the record after the CRM Platform action has been performed. 

PreEntityImages and PostEntityImages contain snapshots of the primary entity's attributes before and after the core platform operation. Following tables describes PreImage, PostImage availability:



Pre-Image
Post-Image
Pre
Post
Pre
Post
Create
No
Yes
No
Yes
Update
Yes
Yes
No
Yes
Delete
Yes
Yes
No
No


Note. Target entity only contains attributes platform needs to update.

Friday, 4 December 2015

JavaScript in MS CRM 2013/2015

Get current entity name

var entity = Xrm.Page.data.entity.getEntityName();

Disable the field


Xrm.Page.getControl("telephone1").setDisabled(true);

Hide field

Xrm.Page.getControl("telephone1").setVisible(false);

Get value from one field and set to other field

var phone = Xrm.Page.getAttribute("telephone1").getValue();
    
        Xrm.Page.getAttribute("fax").setValue(phone);

Get Current User Role

Xrm.Page.context.getUserRoles();

Hiding tab
Xrm.Page.ui.tabs.get(tabindex).setVisible(false);
or
Xrm.Page.ui.tabs.get("tabname").setVisible(false);

Showing tab
Xrm.Page.ui.tabs.get(tabindex).setVisible(true);
or

Xrm.Page.ui.tabs.get("tabname").setVisible(true);