Sunday, 27 November 2016

If you enable the hierarchy setting for this relationship, all rollup definitions that use the existing hierarchy will become invalid

Hi, 

Today, I was creating a Hierarchy Setting on the entity and got the below message.

If you enable the hierarchy setting for this relationship, all rollup definitions that use the existing hierarchy will become invalid
I did search for the meaning and here it is.

Check that you have already a relation that has been declared as Hierarchy while in the relation ship as by rule we can have only one and self relation hierarchy.

Hope this helps.

--
Happy CRM'ing
Gopinath

An Error has occurred. {1} {0} while importing to Solution to CRM

Hi
Today when I was importing the solution to CRM 2016 online received the below error.

An Error has Occurred. {1} {0}

Not sure what was the error as it didn't give me a chance to check the log.

The fix is to switch to other browser. I was using IE 11, switching to Chrome solved the issue.

Hope this helps.
--
Happy CRM'ing

Gopinath

Wednesday, 16 November 2016

Get the option set values of a field in an entity in Dynamics CRM using SDK and C# code

Hi,

Today we got a requirement to retrieve OptionSet values of a field from an entity in CRM. Here is the sample code of it.

public static OptionSetMetadata GetOptionSetsValuesInAnEntity(string entityName, string attributeName, IOrganizationService service)
{
       string AttributeName = attributeName;
       string EntityLogicalName = entityName;
       RetrieveEntityRequest retrieveDetails = new RetrieveEntityRequest
       {
             EntityFilters = EntityFilters.All,
             LogicalName = EntityLogicalName
       };
       RetrieveEntityResponse retrieveEntityResponseObj = (RetrieveEntityResponse)service.Execute(retrieveDetails);
       Microsoft.Xrm.Sdk.Metadata.EntityMetadata metadata = retrieveEntityResponseObj.EntityMetadata;
       Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata picklistMetadata = metadata.Attributes.FirstOrDefault(attribute => String.Equals(attribute.LogicalName, attributeName, StringComparison.OrdinalIgnoreCase)) as Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata;
       Microsoft.Xrm.Sdk.Metadata.OptionSetMetadata options = picklistMetadata.OptionSet;
      // Use below code to get the Option Set Item Name from Value (optionSetValue)
      //IList<Microsoft.Xrm.Sdk.Metadata.OptionMetadata> OptionsList = (from o in options.Options
      //                                     where o.Value.Value == optionSetValue
      //                                     select o).ToList();
      // string optionsetLabel = (OptionsList.First()).Label.UserLocalizedLabel.Label;
      return options;
}

Hope this helps.

--
Happy CRM'ing

Gopinath

Sunday, 6 November 2016

OOB Actions with Dynamics 365

Hi,

I have started exploring Dynamics 365 and with in sometime no idea where I am going by jumping onto number of articles. However, here is the information about new OOB Action available with Dynamics 365.
With Dynamics 365, a whole new set of actions has been provided to you OOB. As per MSDN documentation, the following are the new set of actions available with this release.
  • Add (Case) to Queue
  • Add user to Record Team
  • Apply Routing Rule (to Case)
  • Calculate Actual Value (of Opportunity)
  • Close Opportunity
  • Get Quote Products from Opportunity
  • Get Sales Order Products from Opportunity
  • Lock Invoice Pricing
  • Lock Sales Order Pricing
  • Qualify Lead
  • Remove User from Record Team
  • Resolve Incident
  • Resolve Quote
  • Revise Quote
  • Unlock Invoice Pricing
  • Unlock Sales Order Pricing
Just create a new process (Action/Workflow) and select "Perform Action" and select required action which you need to perform.
Click on View Properties and set the required values to perform the action.
Save and Activate.

That's it, whenever it runs the Action/Workflow performs the action which is configured.

Hope this helps.
--
Happy CRM'ing

Gopinath

Editable Grid Events in Dynamics 365

Editable Grid support the below JavaScript events for home grid and sub-grids
  • OnRecordSelect
  • OnSave
  • OnChange
OnRecordSelect
  • Event triggers when a single row is selected in the editable grid.
  • This event won’t trigger if a user selects different cells in the same row or selects multiple rows.
// Register this event on onRecordSelect event
function gridRowSelect() {
    // Read selected rows from editable sub grid
    var selectedRows = Xrm.Page.getControl("subGridAccounts").getGrid().getSelectedRows();
}

OnChange
  • The OnChange event occurs when a value is changed in a cell in the editable grid and the cell loses focus.
  • This event can also occur when an attribute value is updated using the setValue method.
OnSave
The OnSave event occurs before sending the updated information to the server, and when any of the following occurs
  • There is a change in the record selection.
  • The user explicitly triggers a save operation using the editable grid’s save button.
  • The user applies a sort, filter, group, pagination, or navigation operation from the editable grid while there are pending changes

Some important points to consider for the OnSave event:
  • If a user edits multiple columns of the same record in sequence, the OnSave event will only be fired once to ensure optimal performance and form behavior compatibility.
  • Editable grid and the parent form have separate save buttons. Clicking the save button in one will not save changes in the other.
  • Editable grid does not save pending changes when navigation operations are performed outside of its context. If the control has unsaved data, that data may be lost. Consequently, the OnSave event may not fire. For example, this could happen when navigating to a different record using a form lookup field or through the ribbon.
  • Pressing the refresh button in the editable grid causes it to discard any pending changes, and the OnSave event won't be fired.
  • Editable grid control does not implement an auto-save timer.
  • Editable grid suppresses duplicate detection rules.

Hope this helps.
--
Happy CRM'ing

Gopinath

Configure Editable Grid in Dynamics 365

The most awaited feature of Dynamics CRM is Editable Grid. Here are the list of things which are supported via Editable Grid.
  • In-grid editing of records at the entity or sub-grid level
  • Web and mobile clients
  • Navigation using a keyboard or mouse
  • Grouping and Sorting (Able to group by/sort by any column on current view)
  • Filtering
  • Moving and resizing columns
  • Pagination
  • Lookup configuration
  • Calculated fields and Rollup fields
  • Business rules
  • Hierarchical view
  • Enabling or disabling of cells based on security role
  • Editable Grid respect read-only grid metadata and configurations
  • Editable Grid support the below JavaScript events for home grid and sub-grids: Check this Post for more information on the events.
    • OnRecordSelect
    • OnSave
    • OnChange
  • Editable Grid support the below entity level Business Rules:
    • Show error message
    • Set field value
    • Set business required
    • Set default value
    • Lock or unlock field
  • Editable Grid supports most of data types except:
    • State
    • Customer type field
    • Composite field
    • Partylist
    • Lookup entity related fields

Here are the steps to Enable it on Dynamics 365

Navigate to Settings -> Customizations -> Customize the System.

Click on the entity (for example : Account) for which you want to configure the grid. Click on Controls Tab.


click on "Add Control" and select on Editable Grid.
Select Web Option for the Editable Grid Control.


Microsoft Dynamics 365 Read-Only Grid is the initial default for Web, Phone and Tablet.
After adding an Editable Grids control to an entity you will get a Events tab for setting the events to fire in the grid (Check this Post)
Click on Add Lookup link as shown below to select the view.


In the “Configure Property Add Lookup” dialog, in the Available Views drop-down, select which view to add the lookup to (eg My Active Accounts) and the lookup column you want added (eg Primary Contact) in the Available Columns drop-down.

Click on Save and Publish the entity.



Navigate to Accounts -> My Active Accounts View, you will see Editable Grid.
We can edit the data inline and will unsaved changes label at the below.
We can also apply grouping, eg group the grid by the field “Address 1: City”
Check this for Editable Grid Events


Hope this helps.
--
Happy CRM'ing
Gopinath