Sunday 23 March 2014

Quick Create Forms in MS CRM 2013


Quick Create forms is the new and wonderful feature given in MS CRM 2013. These are populated when users uses Create+ button in the top navigation bar.
CRM gave Quick Form for the below entities by default

  • Account
  • Campaign Response
  • Case
  • Competitor
  • Contact
  • Lead
  • Opportunity
Activity entities do not support quick create forms. Any of the other System Entities and any custom entities that are not custom activity entities can be enabled to support these forms by selecting Allow Quick Create in the entity definition and creating a quick create form for them.

CRM gave a possibility to create multiple quick create form but all users can only should be used by everyone.
The entity must have the Allow Quick Create option enabled for the quick create form to be displayed.


1.    In the Navigation Pane, click or tap Settings -> Customization -> Customizations. Then click or tap Customize the System.

2.    In the solutions explorer, expand the entity that you want and select Forms.

3.    Select New -> Quick Create Form from the tool bar.

Edit a Quick Create Form: While quick create forms support form scripts and business rules, the purpose of them is different from main forms and they don’t support all the capabilities of main forms. Quick create forms always have one section with three columns. You can’t add additional sections or columns.

The following controls cannot be added to quick create forms:


  • Sub-grids
  • Quick View Forms
  • Web resources
  • IFRAMEs
  • Notes
  • Bing Maps

 

Wednesday 12 March 2014

Run a workflow using JavaScript in CRM 2011

Run a workflow using JavaScript in CRM 2011

Here is the code to run workflow using JavaScript

function RunWorkFlow() {
    var entityId = Xrm.Page.data.entity.getId().substring(1, 37); //Guid of record that workflow is to run on.
    var workflowId = "090227fa-68ad-453b-8ea5-3ca63058d240"; //Workflow Guid.
    var url = Xrm.Page.context.getServerUrl();
    var OrgServicePath = "/XRMServices/2011/Organization.svc/web";
    url = url + OrgServicePath;
    var request;
    request = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
              "<s:Body>" +
                "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">" +
                    "<request i:type=\"b:ExecuteWorkflowRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\" xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">" +
                    "<a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">" +
                        "<a:KeyValuePairOfstringanyType>" +
                        "<c:key>EntityId</c:key>" +
                        "<c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + entityId + "</c:value>" +
                        "</a:KeyValuePairOfstringanyType>" +
                        "<a:KeyValuePairOfstringanyType>" +
                        "<c:key>WorkflowId</c:key>" +
                        "<c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + workflowId + "</c:value>" +
                        "</a:KeyValuePairOfstringanyType>" +
                    "</a:Parameters>" +
                    "<a:RequestId i:nil=\"true\" />" +
                    "<a:RequestName>ExecuteWorkflow</a:RequestName>" +
                    "</request>" +
                "</Execute>" +
                "</s:Body>" +
            "</s:Envelope>";
    var req = new XMLHttpRequest();
    req.open("POST", url, true)
    // Responses will return XML. It isn't possible to return JSON.
    req.setRequestHeader("Accept", "application/xml, text/xml, */*");
    req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
    req.onreadystatechange = function () { assignResponse(req); };
    req.send(request);
}

function assignResponse(req) {
    if (req.readyState == 4) {
        if (req.status == 200) {
            //alert('successfully executed the workflow');
        }
    }
}

--
Happy CRM’ing

Gopinath

Friday 7 March 2014

Secure and UnSecure Configuration in MS CRM

Difference between Secure / Unsecure Configuration of Plugin Registration tool in CRM 2011

As you all know the plugin registration tool in CRM 2011 contains Secure and Unsecure configuration sections as shown below.

Following are the two key differences found between these two configuration settings.


Unsecure Configuration
Secure Configuration
Unsecure configuration information could be read by any user in CRM. Remember its public information (Ex: Parameter strings to be used in plugin could be supplied here)
The Secure Configuration information could be read only by CRM Administrators.(Eg: Restricted data from normal user could be supplied here)
Imagine that you include a plugin, plugin steps and activate them in a solution. Later solution was exported as Managed Solution to another environment. In this scenario, the supplied unsecure configuration values would be available in the new environment.
The plugin with secure configuration in a solution was exported as Managed Solution to another environment. In this scenario, the supplied secure configuration information would NOT be available in the new environment. The simple  reason behind this is to provide more security to the contents of Secure Configuration


Thursday 6 March 2014

Outlook CRM button not appearing/CRM failed to Connect

CRM 2011 – Outlook CRM button not appearing/CRM failed to Connect

I had installed the outlook Add-In and it had been running for a month or so and then suddenly it stopped appearing in Outlook.

The folders weren't there and none of the functionality was showing.

After some investigation I found out the Add-In had been disabled! I have no idea when, how or who did this.

For CRM add-ins

Outlook -> Options -> Add-Ins

This will then show you the list of Add-Ins and if they are active, inactive or disabled

 Follow the bellows steps to enable it.


    Select COM Add-ins and click on Go button.



    Just select Microsoft Dynamics CRM and click on OK.

Installing Microsoft Dynamics CRM 2011 Outlook Client on Windows 8 and Office 2013

Installing Microsoft Dynamics CRM 2011 Outlook Client on Windows 8 and Office 2013

I recently installed Windows 8 and Office 2013 on my system and had some issue when trying to install the CRM Outlook Client. I won’t go into all the scary details about what I did to figure this out but here is the solution.
I got two error messages one after the other…


“There is a problem communicating with the Microsoft Dynamics CRM server. The server might be unavailable. Try again later. If the problem persists, contact your system administrator.”
“Cannot connect to Microsoft Dynamics CRM server because we cannot authenticate your credentials. Check your connection or contact your administrator for more help.”
 Issue #1 – CRM Outlook Client Install does not enable Microsoft Identity Foundation 3.5. This will cause this error:
“Cannot connect to Microsoft Dynamics CRM server because we cannot authenticate your credentials. Check your connection or contact your administrator for more help.”
Windows 8 comes with it installed but not enabled. Enable it.

Issue #2CRM Outlook Client does not install the correct versions of SQL Server Compact 3.5 on 64-bit Operating Systems. This will cause this error:
“There is a problem communicating with the Microsoft Dynamics CRM server. The server might be unavailable. Try again later. If the problem persists, contact your system administrator.”
In the CRM Client log you will see this error: Error| Exception: Unable to load DLL ‘sqlceme35.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Wednesday 5 March 2014

CRM Error – Invalid Action – the selected action was invalid


CRM Error – Invalid Action – the selected action was invalid



a) Launch the Services.msc console on the CRM server. (Click Start, then click All Programs, then click on Administrative tools and then select Services.)
b) Select the service named "Microsoft CRM Asynchronous Processing Service"

c) Right click the service and select the Start.

Once the Microsoft CRM Asynchronous Processing Service is successfully started, verify that you can now login to Dynamics CRM


--

Happy CRM’ing
Gopinath


 

JavaScript in Microsoft Dynamics CRM 2013/2011

JavaScript in Microsoft Dynamics CRM 2013/2011

The JavaScript object model is the JavaScript API that CRM provides to enable you to customize various behaviors based on events and to access CRM data that exists on a form.
CRM 2013 fully supports the JavaScript object model from the previous version; however, it does not support the JavaScript object model from Microsoft Dynamics CRM 4.0.
The following is the reference documentation for client-side events and object models that can be used with JavaScript libraries. * marked are new in CRM 2013.
Xrm.Utility: The Xrm.Utility object provides a container for useful functions not directly related to the current page. This object was added in Microsoft Dynamics CRM 2011 Update Rollup 8. The following table lists the functions of Xrm.Utility.
Xrm.Utility
alertDialog
Displays a dialog box with a message.
confirmDialog
Displays a confirmation dialog box that contains a message as well as OK and Cancel   buttons.
isActivityType
Determine if an entity is an activity entity.
openEntityForm
Opens an entity form.
openWebResource
Opens an HTML web resource.

Xrm.Page.data: Xrm.Page.data provides an entity object that provides collections and methods to manage data within the entity form. The following tables lists the functions of Xrm.Page.data and Xrm.Page.data.entity.

Xrm.Page.data
getIsValid*
Do a validation check for the data in   the form.
refresh*
Asynchronously refresh all the data of the form without reloading the page.
save*
Saves the record asynchronously with the option to set callback functions.
Xrm.Page.data.entity
addOnSave
Adds a function to be called when the record is saved.
getDataXml
Returns a string representing the xml that will be sent to the server when the record is saved.
getEntityName
Returns a string representing the logical name of the entity for the record.
getId
Returns a string representing the GUID   id value for the record.
getIsDirty
Returns a Boolean value that indicates if any fields in the form have been modified.
getPrimaryAttributeValue*
Gets a string for the value of the primary attribute of the entity.
removeOnSave
Removes a function to be called when the record is saved.
save
Saves the record with the options to close or new.

Xrm.Page.context: provides methods to retrieve information specific to an organization, a user, or parameters that were passed to the form in a query string. The following table lists the functions of Xrm.Page.context.

 Xrm.Page.context
client.getClient*
Returns a value to indicate which client the script is executing in.
client.getClientState*
Returns a value to indicate the state of the client.
getClientUrl
Returns the base URL that was used to access the application.
getCurrentTheme
Returns a string representing the current Microsoft Office Outlook theme chosen by the user.
getOrgLcid
Returns the LCID value that represents   the base language for the organization.
getOrgUniqueName
Returns the unique text value of the   organization’s name.
getQueryStringParameters
Returns a dictionary object of key   value pairs that represent the query string arguments that were passed to the   page.
getUserId
Returns the GUID of the SystemUser.Id value for the current user.
getUserLcid
Returns the LCID value that represents the provisioned language that the user selected as their preferred language.
getUserName*
Returns the name of the current user.
getUserRoles
Returns an array of strings that represent the GUID values of each of the security roles that the user is  associated with.
isOutlookClient
(Deprecated) Returns a Boolean value indicating if the user is using Microsoft Dynamics CRM for Outlook.
isOutlookOnline
(Deprecated) Returns a Boolean value that indicates whether   the user is connected to the CRM server.
prependOrgName
Prepends the organization name to the   specified path.

Xrm.Page.ui:  Xrm.Page.ui provides collections and methods to manage the user interface of the form. The following table lists the functions of Xrm.Page.ui
Xrm.Page.ui
clearFormNotification*
Remove form level notifications.
close
Method to close the form.
formSelector.getCurrentItem
Method to return a reference to the   form currently being shown.
formSelector.items
A collection of all the form items accessible to the current user.
getViewPortHeight
Method to get the height of the viewport in pixels.
getViewPortWidth
Method to get the width of the viewport   in pixels.
getCurrentControl
Get the control object that currently has focus.
getFormType
Get the form context for the record.
navigation.items
A collection of all the navigation items on the page.
setFormNotification*
Display form level notifications.
refreshRibbon
Re-evaluate the ribbon data that controls what is displayed in it.
 Collections
Xrm.Page.data.entity.attributes
All attributes on the page.
Xrm.Page.ui.controls
All controls on the page.
Xrm.Page.ui.formSelector.items
All the forms available to the user.
Xrm.Page.ui.navigation.items
All the items in the form navigation   area.
Xrm.Page.ui.tabs
All the tabs on the page.
Xrm.Page Attribute.controls
All the controls for the attribute.
Xrm.Page.ui Section.controls
All the controls in the section.
Xrm.Page.ui Tab.sections
All the sections in the tab.
 Collections Methods
forEach
Apply an action in a delegate function to each object in the collection.
get
Get one or more object from the collection depending on the arguments passed.
getLength
Get the number of items in the collection.

Attributes: Attributes store the data available in the record. Attributes are available from the Xrm.Page.data.entity.attributes collection. To access an attribute you can use the Xrm.Page.data.entity.attributes.get method or the shortcut version Xrm.Page.getAttribute. Following table shows how you can query attribute properties to understand what kind of attribute it is or change the behavior of the attribute.
 Xrm.Page.getAttribute(“…”)
getAttributeType
Get the type of attribute.
getFormat
Get the attribute format.
getIsDirty
Determine whether the value of an   attribute has changed since it was last saved.
getIsPartyList
Determine whether a lookup attribute   represents a partylist lookup.
getMaxLength
Get the maximum length of string which   an attribute that stores string data can have.
getName
Get the name of the attribute.
getParent
Get a reference to the Xrm.Page.data.entity object that is the parent to all attributes.
getRequiredLevel
Returns a string value indicating   whether a value for the attribute is required or recommended.
getSubmitMode
Sets whether data from the attribute   will be submitted when the record is saved. always / never / dirty
getUserPrivilege
Determine what privileges a user has   for fields using Field Level Security.
getValue / setValue
Gets or Sets the data value for an   attribute.
setRequiredLevel
Sets whether data is required or   recommended for the attribute before the record can be saved. none / required  / recommended
setSubmitMode
Returns a string indicating when data   from the attribute will be submitted when the record is saved.
Number Attribute Methods
getMax / getMin
Returns a number indicating the maximum or minimum allowed value for an attribute.
getPrecision
Returns the number of digits allowed to   the right of the decimal point.
setPrecision*
Override the precision set for a number attribute.
DateTime Attribute Methods
setIsAllDay*
Specify whether a date control should  set a value including the entire day.
setShowTime*
Specify whether a date control should  show the time portion of the date.

Controls: Controls represent the user interface elements in the form. Each attribute in the form will have at least one control associated with it. Not every control is associated with an attribute. IFRAME, web resource, and subgrids are controls that do not have attributes. Controls are available from the Xrm.Page.ui.controls collection. To access a control you can use the Xrm.Page.ui.controls.get method or the shortcut version Xrm.Page.getControl. The following table lists the functions of Controls.
Xrm.Page.getControl(“…”)  
clearNotification*
Remove a message already displayed for   a control.
getAttribute
Get the attribute that the control is   bound to.
getControlType
Get information about the type of   control.
getDisabled / setDisabled
Get or Set whether the control is   disabled.
getLabel / setLabel
Get or Set the label for the control.
getName
Get the name of the control.
getParent
Get the section object that the control   is in.
getVisible / setVisible
Get or Set a value that indicates   whether the control is currently visible.
setFocus
Sets the focus on the control.
setNotification*
Display a message near the control to   indicate that data is not valid.

 Lookup Controls: The following table lists the functions of Lookup Control
addCustomFilter*
Use fetchXml to add additional filters   to the results displayed in the lookup. Each filter will be combined with an   ‘AND’ condition.
addCustomView
Adds a new view for the lookup dialog   box.
addPreSearch*
Use this method to apply changes to   lookups based on values current just as the user is about to view results for   the lookup.
getDefaultView / setDefaultView
Get or Set Id value of the default   lookup dialog view.
removePreSearch*
Use this method to remove event handler

OptionSet: The following table lists the functions of OptionSet Control.
getInitialValue
Returns a value that represents the   value set for an optionset or boolean when the form opened.
getOption[s]
Returns an option object with the value   matching the argument passed to the method.
getSelectedOption
Returns the option object that is selected.
getText
Returns a string value of the text for   the currently selected option for an optionset attribute.
adoption / removeOption
Adds or remove an option to an option   set control.
clearOptions
Clears all options from an Option Set   control.

IFRAME and Web Resource Controls:  An IFRAME control allows you to include a page within a form by providing a URL. An HTML web resource added to a form is presented using an IFRAME element. Silverlight and image web resources are embedded directly within the page. The following table lists the functions of IFrame or Web Resource controls.
getData / setData
Get or Set the value of the data query   string parameter passed to a Silverlight web resource.
getInitialUrl
Returns the default URL that an I-frame   control is configured to display. This method is not available for web   resources.
getObject
Returns the object in the form that   represents an I-frame or web resource.
getSrc / setSrc
Get or Set the current URL being   displayed in an IFrame or web resource.

OnChange Event: There are three methods you can use to work with the OnChange event for an attribute.
addOnChange / removeOnChange
Sets or remove a function to be called   when the attribute value is changed.
fireOnChange
Causes the OnChange event


--
Happy CRM’ing
Gopinath