Posted in Dynamics CRM 365 Online

Enable Add New(+) Connection Button On Opportunity

Out of the box on opportunity form, we have a connection sub grid named “stakeholders”. You can add new connections of type stakeholder from this subgrid which is amazing , however what if we need ability to create any other type connections from opportunity. 

Connections ofcourse has inbuilt functionality for opportunity to behave this way.
The subgrid uses a default view “All Stakeholders” hence it will let you add only stakeholder connections. 

Let’s change this view to “All Active Connections” :

Select this view, save changes & publish the form. Lets see what happens now:

Strangely, we dont have a plus button , so person will have to click on see all records/see associated record and then add the connections from.

Solution:

I have found a workaround by playing around the ribbon workbench. 
1. To do this, create a temporary solution and add “connections” entity to it. 

2. Next step is to install ribbon workbench if you dont have already. You can get it from here:
https://www.develop1.net/public/rwb/ribbonworkbench.aspx  

3. Once you have download the solution, install the solution to your dynamics 365 instance.

 

4. Click on the ribbon workbench button from your solutions are and select the newly create solution in the popup ( which we create for connection entity):

We are now going to make some ribbon changes, i would recommend to take a backup of the newly solution we have created so if anything goes wrong we can always import it back.

5. Right click on the +New button the subgrid ribbon and right on it. 
 Select “customize button” then again right click and select “Customize command”:

6. Now move to the enable rule “Mscrm.ShowOnHomeGridAndOnSalesCustomSubGrids” under command “Mscrm.SubGrid.connection.NewRecord” & scroll down to the “Custom rule” as shown below.

7. In this rule make “Default” field to “true” as well as Invert rule to true as well:

8. Now click on publish button from the ribbon workbench which will take some time.

9. Navigate to your opportunity now and you will the + button from subgrid now:


I hope this helps, here are some final notes:

  1. Connections entity doesnt support quick create form hence do not expect it open a quick create on the right side when you click on this button.  It will open a new window , you have fill details and click on save & close.
  2. When new connection screen opens it will have opportunity in both connected to and connected from fields. You will have to apply basic javascript to clear one of the field so that user can select the customer /account in connected to field.
  3. Connections do not support business rule.

Cheers!

Posted in CRM Code Helpers

Get Most Recent Created On Record from Retrieved Entity Collection In Plugin

Sometimes, you may have a requirement to get the most recently created on record from the entity collection you have retrieved.

Instead of playing around a lot with coding and .net stuff, Dynamics CRM fetch XML and QueryExpression provides a way to sort records Ascending or descending.

Therefore, While retrieving records in FetchXML, do this :

<entity name='entityname'>
 <attribute name='atrributename1' /> 
   <attribute name='atrributename2' />    
    <attribute name ='attributename3' />                       
      <order attribute='createdon' descending='true' /> 
     <filter type='and'>                                  
     <condition attribute='statecode' operator='eq' value='0' />
   </filter>
</entity>

Or in Query Expression:

QueryExpression qe = new QueryExpression(entityName);
FilterExpression fe = new FilterExpression();
qe.ColumnSet = new ColumnSet(true);
qe.Orders.Add(new OrderExpression(columnname, ordertype)); 
service.RetrieveMulti ple(qe);

 

when Execute them , you will get the desired record on the top which can be access by simply by doing retrievedResult[0] or :

firstRecord= retrievedResult.Entities.First(); //first method.

firstrecord

I hope this helps!

cheers!

 

Posted in Reblogged

How to use Configuration Migration / Data Migration Utility in Dynamics CRM

Explore Dynamics CRM

In this blog i will detail on using Configuration Migration/ Data Migration utility. This can be used to move the configuration data from one CRM environment to other. generally Configuration data is used to defines custom functionality in CRM, which is typically stored in custom entities.

Often we need to migrate configuration data from one CRM environment to other, especially test data, master data setup etc. Microsoft provided an excellent tool for doing this.

Following are the benefits of using this tool,

  1. allows you to select entity and fields from where you want to export the configuration data.
  2. large amount of data from multiple entities can be moved from one crm environment to other.
  3. Data can be imported using the same GUID’s as that of the source system, hence lookup references to imported records will be valid.
  4. Schema file can be reused to export data from different source environments.

Below…

View original post 718 more words