Blog Archives

CRM 2011 Training Series – How to Schedule reports in CRM 2011?

 How to Schedule reports in CRM 2011?

The Microsoft Dynamics CRM 2011 schedule report feature is used for creating report snapshots. There are a few reasons to use this report snapshot functionality:

  • Send as a SQL Report Server email subscription
  • Cache ‘point-in-time’ snapshots
  • Use as the user-run report for especially long-running reports

Select the report you wish to schedule and click Schedule Report from the ribbon:

062911_1933_ReportSched1

This will launch a wizard for creating the snapshot

In our scenario we are going to select ‘On a schedule’

062911_1933_ReportSched2

Frequency window offers a myriad of options. Set your run time (server time)

062911_1933_ReportSched3

Select a start date and end date, if necessary

062911_1933_ReportSched4

If the report has parameters you will need to select them here. Optionally you could the edit the filter and for example use date parameters such as ‘Last x days’ that will of course be respected for each subsequent snapshot.

062911_1933_ReportSched5

A final review screen will summarize your selections

062911_1933_ReportSched6

It is now essentially a copy of the report you selected so you have the same options such as visibility controlled by the ‘Display In’ selection. If the report will be used for an email subscription you may decide to hide the snapshot from general users.

062911_1933_ReportSched7

After your snapshot has run it will be accessible from the report management list in CRM

062911_1933_ReportSched8

In order to set up the email schedule we need to navigate to the CRM report server and the organization that you were accessing. Usually this will be http://ReportServerName/Reports

The scheduled snapshot will be in the ‘CustomReports’ folder

062911_1933_ReportSched9

Hover over your snapshot report to see the drop down menu and select ‘Subscribe’

062911_1933_ReportSched10

The first time a subscription is set up for this report you will need to select ‘New Subscription’. If you come back to modify the subscription you will select and edit

062911_1933_ReportSched11

Several options for emailing: The subscription can go to any address however if you check the ‘Include Link’ only CRM users will be able to access. If any recipients will be non-CRM users you will want to check the ‘Include Report’ box and select a render format – the same options are available as when you run the report (Excel, PDF, etc.)

I like to include a valid ‘Reply-To’ address in the user has issues they may be apt to click reply

The subject will default with @ReportName variable which will be the GUID of the report. I recommend changing to friendly text

062911_1933_ReportSched12

Lastly click the ‘Select Schedule’ button to schedule the email.

Since I had set the snapshot to run at 3:00 PM I’m choosing to send the email at 3:02.

Just like the CRM schedule you can set start and end dates.

Click OK and wait for the scheduled email!

062911_1933_ReportSched13

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

CRM 2011 Training Series – What is the difference between Append and Append To?

What is the difference between Append and Append To?

Here’s an easy example to help remember the distinction between the Append and Append To Rights defined in CRM’s Security Roles.

Consider the situation when a user needs to set the Parent Customer field on the Contact. Beyond the obvious ‘write’ permission on the contact, they also need the “Append” right for that Contact and the “Append To” right for the intended parent Account record.

AppendTo

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

CRM 2011 Training Series – Differences between Workflows and plugins in CRM 2011

Differences between Workflows and plugins in CRM 2011

Criteria Use Plugin Use Workflow Use Dialog
Needs custom logic to execute synchronously. Plugins support synchronous execution. NA Dialogs always execute synchronously.
The logic needs to be executed while offline Only plugins are supported offline. NA NA
Needs elevation of privileges (impersonation) In the plugin step, you can select the user under which the plugin will execute by setting the impersonating user id in the plugin step. In some cases you can control under which user the workflow will execute by assigning the workflow to that user. NA
Needs to execute on events other than assign, create, update and set state Can be registered on a large list of sdk messages. NA NA
The process/logic may take a long time to complete or will be a persistent process (multiple long running steps) NA Workflows have no limit on the length of time they can take to complete execution. They can also persist (pause) and resume at a later date. Plugins have a time limit of a couple of minutes to complete (even asynchronous plugins). NA
Needs to execute asynchronously Plugins support asynchronous execution Workflows support asynchronous execution NA
End users will need to modify the process logic NA Processes can be modified using the CRM process designer in the application and does not require IT administrators to re-compile and deploy a plugin assembly.
Child sub processes will be triggered NA CRM processes support executing child processes
Needs to read configuration parameters for execution You can make use of the configuration and secure configuration settings in the plugin step. These values will be passed to the plugin constructor and can be easily updated. NA Dialogs cannot be configured with configuration parameters but they can retrieve configuration information from user responses / interactions.
Need to execute logic on-demand NA Workflows and dialogs can be executed on-demand. Plugins can only be triggered as a result of a specified action to which the plugin step is configured.
Needs to roll back transaction in case of error (useful for validation) Plugins can be registered in-transaction so they are able to roll-back the main operation if the plugin fails. Workflows are executed post-transaction so they cannot roll back the main operation. NA NA
The plugin/workflow logic is not possible to implement by using the CRM process designer Plugins are written in .NET and this supports any action that can be achieved using the CRM SDK. You can extend workflows/dialogs by creating a custom workflow activity which is also written in .NET calling any method from the CRM SDK. However, this is not supported in CRM Online yet.
Interaction with user is required to execute the custom logic NA NA CRM dialogs support the execution of a process which dynamically takes input from question asked to the user.
Need custom logic to execute before the main operation Only plugins can be registered to execute pre- main operation. NA NA
Need to gather data from the entity pre-image (image of the entity before the main operation) You can register pre-images for plugin steps. Pre-image is available only from custom workflow activities (not supported in CRM Online)
Need to gather data from the entity post-image (image of the entity after the main operation) You can register post-images for plugin steps. Post image is available from the process designer in the CRM application.
Needs to be packaged into a solution Plugins and processes are solution aware
Need to use variables to store temporary data Use the SharedVariables collection to store variables that can be passed to other plugins. Use the SharedVariables collection to store variables that can be passed to other workflow steps. These variables do not survive persistence and can only be used from custom workflow activities. Not supported in CRM Online. Dialog support variables of type string, int and float that can be passed from one step to another. For other types, SharedVariables can be used from custom workflow activity.

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

CRM 2011 Training Series – How to create a custom button in CRM 2011?

How to create a custom button in CRM 2011?

Here is a beautiful post on msdn on how to create custom button in CRM 2011.

This walk through shows you how to create the following new custom Send to Other System button to the Collaborate group for the Account entity ribbons:

Account entity form ribbon
IC4438741
Account entity grid ribbon
IC4438752

Before you begin, you must have a clear set of requirements. This button:

  1. Will appear only for the Account entity.
  2. Will appear to the right of the Assign button on the account form ribbon Collaborate group.
  3. Will appear to the right of the Assign button on the account grid Collaborate group.
  4. Will appear only in the Web client.
  5. In the account form, this button will only be displayed if the record has been saved.
  6. In the account grid, this button will only be enabled when a single account record is selected.
  7. Will have the label Send to Other System.
  8. Will have a tooltip that displays the label text and the description Sends this Record to another system.
  9. When clicked, the button will display a JScript alert message saying “This record has been sent to another system.”This message will be displayed using the send function defined in a script Web resource named ‘sample_ SendToOtherSystem.js’.
  10. This button will reference Web resource images to represent the icons.The icons will use two Portable Network Graphics (PNG) Web resource images:

To know how to get this done, check the msdn page here: http://msdn.microsoft.com/en-us/library/gg334341.aspx?

 

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

CRM 2011 Training Series – What’s the difference between FetchXML and QueryExpression?

What’s the difference between FetchXML and QueryExpression?

These are the two distinct ways that you can query CRM using CRM SDK to retrieve the required information.

QueryExpression is the mostly commonly used way for querying information in CRM. Probably because it uses the object oriented style of coding and so you have distinct classes for query, condition, columns etc. Youhave intellisense to support you when writing a query using QueryExpression.

However, it has its own limitations, one of them being the inability to provide a column of a linked entity to be returned as the query result. This perhaps because the Query Expression would return a dynamic entity or a strongly typed base entity and so it is unable to return columns of related entity.

So you are not able to execute a query similar to the following

Select Opportunity.name, Opportunity.estimatedvalue, Account.address1_city from FilteredOpportunity Opportunity
Inner join
FilteredAccount Account on Opportunity.customerid = Account.accountis
Where account.address1_country = “US”

This is however possible using FetchXML. FetchXML requires the query to be specified in XML format and the resultset is returned in XML format as well. This allows FetchXML to return related entity columns as well as this is just another node in the xml doc.

The above select query can written as follows using FetchXML

<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity name=”opportunity”>
<attribute name=”name”/>
<attribute name=”estimatedvalue”/>
<attribute name=”opportunityid”/>
<order attribute=”name” descending=”false”/>
    <link-entity name=”account” from=”accountid” to=”customerid” alias=”aa”>
<attribute name=”address1_city”/>
    <filter type=”and”>
                <condition attribute=”address1_country” operator=”eq” value=”US”/>
    </filter>
    </link-entity>
    </entity>
</fetch>

Note: CRM Views allow you to select columns of related entity to be displayed in the view… how do you think they do it? FectchXML ofcourse. The query of the view created is stored as a FetchXML query in the SavedQuery entity.

CRM also provides the following messages to convert FetchXML to QueryExpression and vice versa.

– FetchXmlToQueryExpression : Converts from FetchXML to query expression.
– QueryExpressionToFetchXml : Converts from query expression to FetchXML.

Note again, if you are to convert a FetchXML that has select columns specified from related entity, to Query Expression, the related entity columns are not included in the QueryExpression columns list.

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

CRM 2011 Training Series – How to use Secure and Non-Secure configuration in Plugin?

When you register a plugin step, there is a field where you can specify some configuration parameters for the plugin execution:

SecureNonSecure ConfigPLugin
Then in the Constructor of your plugin class you will get the configuration value which you can use later in the Execute method:

 

public abstract class BasePlugin : IPlugin
{
private string _secureConfig = null;
private string _unsecureConfig = null;

public BasePlugin(string unsecureConfig, string secureConfig)
{
_secureConfig = secureConfig;
_unsecureConfig = unsecureConfig;
}

public void Execute()
{
// Use the configuration here
}
}

 

There are two different kinds of Configurations.

 

Secure Configuration:
PROS:

  • The step configuration is solution-aware so it will be automatically transported with the plugin step.

CONS:

  • You need to use the plugin registration tool or another application to update the step configuration.
  • The configuration is step-specific so you have to provide it and/or update it for every step even if the value is the same for all the steps (the configuration is on each step instead of the assembly or plugin type).
  • the configuration is just an attribute of the plugin step so you cannot control privileges on the configuration independently from privileges on plugin step entity.

Non- Secure Configuration:
PROS:

  • The configuration data can be secured as any other entity using the CRM security model. This is useful when the configuration contains sensitive information such as passwords.

CONS:

  • Secure configuration is not solution aware so you will need to configure it for each environment.
  • You need to use the plugin registration tool or another application to update the step configuration.

The configuration is step-specific so you have to provide it and/or update it for every step even if the value is the same for all the steps (the configuration is on each step instead of the assembly or plugin type).

 

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

 

CRM 2011 Training Series – Why workflows are not allowed in CRM 2011 Online?

Why workflows are not allowed in CRM 2011 Online?

Ever think of why custom workflows are not allowed in CRM 2011 Online version? Here is the reason for that. First you need to know how the CRM pipeline processes work.

Trusts

Plug-in developers have the option of registering their plug-ins in the sandbox, known as partial trust, or outside the sandbox, known as full trust. Full trust is supported for on-premises and internet facing Microsoft Dynamics CRM deployments. For a Microsoft Dynamics CRM Online deployment, plug-ins must be registered in the sandbox (partial trust) where they are isolated as previously described.

The Sandbox

Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online support the execution of plug-ins in an isolated environment. In this isolated environment, also known as a sandbox, a plug-in can make use of the full power of the Microsoft Dynamics CRM SDK to access the organization Web service. Access to the file system, system event log, certain network protocols, registry, and more is prevented in the sandbox. However, sandbox plug-ins do have access to external endpoints like the Windows Azure cloud.

So what exactly is the problem?

In a nutshell, if you have CRM on-premise, then you will not see that much difference in the plug-in environment. But, if you are using CRM 2011 Online, you now have the ability to install plug-ins into a CRM organization in what is called a Sandbox, which restricts the actions your plug-in can perform. Code within the Sandbox runs in partial-trust mode.

Windows Workflow Foundation requires a full-trust environment in order to function properly. But, in order to provide any plug-in functionality within CRM Online, Microsoft has restricted that all custom code to the Sandbox for stability and security purposes.

So, without full trust, we do not have the ability to install and run custom workflow activities on CRM Online.

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

CRM 2011 Training Series – How to disable all fields on the form through Jscript?

How to disable all fields on the form through Jscript?

There are many occasions where you need to disable all fields/controls on an entity form. Here is the code snippet that shows how to do that.

// JScript source code
function DisableFieldOnHold() {
if (Xrm.Page.getAttribute(“statuscode”).getValue() == “2”) {
disableFields();
}
function disableFields() {
var attributes = Xrm.Page.data.entity.attributes.get();
for (var i in attributes) {
Xrm.Page.getControl(attributes[i].getName()).setDisabled(true);
Xrm.Page.getControl(“statuscode”).setDisabled(false);
}
}
if (Xrm.Page.getAttribute(“statuscode”).getValue() != “2”) {
enableFields()
}
function enableFields() {
var attributes = Xrm.Page.data.entity.attributes.get();
for (var i in attributes) {
Xrm.Page.getControl(attributes[i].getName()).setDisabled(false);
}
}
}

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.