Featured Post

Web API Requests Series

Web API Series:  Create and Retrieve , Update and Delete , Retrieve Multiple , Associate/Disassociate , Impersonation , Run Workflows

25 March 2012

Read only fields are not saved.

If you are writing your custom web resource and using it to update standard crm fileds, rememember that they will not be saved if they are read-only.
Let me make myself clear with an example.
I was developing an HTML web resource and I was changing the value of a field only shown on the footer. In order to be able to change the value of that field I had to place it on the form as well and hide it. This means that I set, from the form designer, the following properties:
  1. Visible by default = false
  2. Field is read-only = true
If you do this you will be able to access the read-only field but when you save the form that field will not be saved because is read-only.
So what you should do is: Hide the field on the form but don't set the field to be read-only as shown below.















If it is a bug or it is normal, I don't know. If someone knows the reason of this behavior please let me know.
Thank you.

19 March 2012

How to pass parameters from subgrids to JavaScript

In this post I will show you how to pass parameters regarding a grid or subgrid to a JavaScript function by clicking a custom button on the ribbon menu.
A common requirement is to pass poarameters to a JavaScript function called when clicking a Ribbon button.
To pass parameters regarding a grid or a subgrid we can use the "crmparameter" element of the RibbonDiffXml file.
The available parameters can be devided in three groups:

  1. Selected items 
    • SelectedControlSelectedItemCount: The number of selected items in a grid or subgrid.
    • SelectedControlSelectedItemIds: A string array of GUID Id values for all selected items in a grid.
    • SelectedControlSelectedItemReferences: An array of EntityReference objects that represent all the selected items in the grid
  2. All items
    • SelectedControlAllItemCount: The number of items in a grid or subgrid.
    • SelectedControlAllItemIds: A string array of GUID Id values for all items in a grid.
    • SelectedControlAllItemReferences: An array of EntityReference objects that represent all the items in the grid.
  3.  Unselected items
    • SelectedControlUnselectedItemCount: The number of unselected items in a grid or subgrid.
    • SelectedControlUnselectedItemIds: A string array of GUID Id values for all unselected items in a grid.
    • SelectedControlUnselectedItemReferences: An array of EntityReference objects that represent all the unselected items in the grid. 
The way you can pass these parameters by clicking a Ribbon button is shown below:

  <CommandDefinition Id="Mscrm.SubGrid.opportunity.Command">
            <EnableRules>
              <EnableRule Id="Mscrm.SubGrid.opportunity.EnableRule"></EnableRule>
            </EnableRules>
            <DisplayRules></DisplayRules>
            <Actions>
              <JavaScriptFunction Library="$webresource:functions.js" FunctionName="MyFunction" >
                <CrmParameter Value="SelectedControlSelectedItemIds" />
                <CrmParameter Value="SelectedControlSelectedItemCount" />
              </JavaScriptFunction>
            </Actions>
</CommandDefinition>

To access these parameters add them to your function definition like below:

function MyFunction(SelectedControlSelectedItemIds, SelectedControlSelectedItemCount) {
      for (i = 0; i < SelectedControlSelectedItemCount; i++) {
       }
}


So as you can see it is possible to access records displayed in a subgrid using supported code, so don't get tempted to use document.getElementById.  ;)

I hope this help.



14 March 2012

ITSM SEMINAR

Using an ITIL accredited ITSM suite can dramatically improve your operations by:
•Enabling users to log and track their own incidents, change requests and service requests
•Automating SLA adherence, workflows and assignments
•Root cause analysis with deep insight from powerful reporting tools
•Increase end user satisfaction with timely actions and accurate information

During this seminar you will learn how to achieve all of the above and more. Our ITSM enables you to leverage your exisiting environment and maximise effectiveness. We look forward to seeing you in two weeks!!

Register here: http://www.alfapeople.com/UK/EN/Events/Pages/Events.aspx

03 March 2012

Crm 2011 Survey Creator Beta

The Crm 2011 Survey Creator is a CRM solution that allows us to create Surveys in CRM 2011.
A survey can be created in different ways, for example:
  1. From the Contact form
  2. From the Account form
  3. From the Main Page Navigation Pane
A survey consists of the following parts/entities:
  1. Survey Template
  2. Questions Group
  3. Question
  4. Survey
 To create a Survey we first need to create a Survey Template, add Questions Groups to the Template, add Questions to the Group and then we are ready to create our Survey/questionnaire.


1. Create a Survey Template  


















2. Add Questions Groups to the Survey






















We can specify an order number, this will tell in what order to display the question group in the Survey.

3. Add Questions to the Group/s




















4. Here we can specify the question name, if an answer is required or not, the order in which the Question will appear in the Question Group in the Survey, and the type of answer we expect:
  1. Text
  2. Number
  3. Decimal
  4. Date
  5. Yes or No
  6. Picklist/Dropdown
Once we are done with the Template, Groups and Questions we are ready to create a Survey based on the template we created.



















Fill the required fields (the Performed On date will automatically filled in and is read-only) and then save the Survey, when the survey form reloads it will come up with the questions on the form, see below.

Part 1



















Here we can see Text fields, Ye/No and Dropdown.

Part 2














Here we can see a required field in red and Number fields. We also have a little help that says what is the type of the filed. However, Validation on the fields is implemented on the Survey Form. See below for the validation messages:

Validation on Number Fields










Validation on Date Fields










The date separator is based on your CRM customisation so if you enter an "invalid" date you'll be prompted with an error.

Validation on Decimal Fields







Validation on Required Fields








Finally if we try to save a Survey without filling require field we will not be able to save the survey and the user will be prompted with the above message.
One more thing, the survey can be marked as complete by clicking the Custom button "Save as Complete". If we do this the next time we open the survey, all the fields will be disabled and the Survey status at the bottom will say "Completed".

Survey Complete








This is all for today, hope you find this post useful.