Tuesday, 8 December 2015

How to check whether the OpportunityProduct/QuoteProduct/OrderProduct is a bundle, product or bundled product in CRM

Hi,

Today I got a requirement to check the type of the product that is going to add to the opportunity and do some operation based on it.

This can be easily done by referring Product Type field of Opportunity Product /Quote Product/ Order Product. It is an Option Set with the below options.

ItemValue
Product1
Bundle2
Required Bundle Product3
Option Bundle Product4

Required and Optional refers to the Required field on Bundle Product.

Hope this helps.

--
Happy CRM'ing
Gopinath

Monday, 7 December 2015

Stages, Stages Number and their use in CRM Plugins

Hi,

Sometimes we might get the chance to use only one Plugin on different and it would have separate business logic to perform on different stages.

Here is the table which shows the associated stage number with the stage name and the event.
EventStage NameStage NumberDescription
Pre-Event
Pre-validation10Stage in the pipeline for plug-ins that are to execute before the main system operation. Plug-ins registered in this stage may execute outside the database transaction.
Pre-EventPre-operation20Stage in the pipeline for plug-ins that are to execute before the main system operation. Plug-ins registered in this stage are executed within the database transaction.
Post-EventPost-operation40Stage in the pipeline for plug-ins which are to execute after the main operation. Plug-ins registered in this stage are executed within the database transaction.

We can use this numbers as conditions in the plugin as shown below.

You might be thinking why 30 is missing in the middle. We do have 30 but it is for main operation which we cannot use in the custom plugins.

Platform Core OperationMain Operation30In-transaction main operation of the system, such as create, update, delete, and so on. No custom plug-ins can be registered in this stage. For internal use only.

Hope this helps.

--
Happy CRM'ing

Gopinath

Build, Rebuild and Clean in Visual Studio

Hi,

Today I was talking to a fresher and explaining some of the shortcuts in Visual studio and how we build solutions etc.. and so thought of the writing about Build, Rebuild and Clean Solution in Visual Studio.

These three things very often used in Visual Studio.

Build Solution
Incremental build and compiles only the files that are modified. When build solution if there are no changes made to the files Visual Studio won't do anything. Visual Studio builds the assembly only if there are changes to the files.


Clean Solution
Deletes all compiled files, output directories. If your solution has multiple projects, VS cleans project by project.


Rebuild SolutionDeletes all compiled files and compiles all the things irrespective changes happened. In simple words, Clean + Build = Rebuild.

Hope this helps.

--
Happy Coding
Gopinath

Add Product, Add Family and Add Bundle button are missing in CRM

Hi,

Today I have activated French language on my CRM and checking some of things. I have a requirement to create a product and navigated to Product Catalog. Unfortunately, I was not able to see Add Product, Add Family and Add Bundle buttons.

English

 French

I thought, it was CRM issue but after some search came to know Products can be added only from the Core language like our Customizations.

Hope this helps.

--
Happy CRM'ing

Gopinath

Thursday, 3 December 2015

Retrieve Access Team Members using FetchXML in CRM 2013/2015

Hi,

Today we got a requirement to fetch the users who are added on the Access Team of the record and do some operation.

Here is the Fetch XML to retrieve the users that were added to access team.

I was using for Order entity. If you are using for any other entity, you need to change the entity name in the 2nd line and ID schema name in the 4th line of the Fetch Xand pass record Id in the filter condition.

public static void GetAccessTeamMembers(IOrganizationService iService)
{
      string strFetchXML = @"<fetch>
                             <entity name='salesorder' >
                               <attribute name='name' />
                                   <link-entity name='principalobjectaccess' from='objectid' to='salesorderid' link-type='inner' alias='poa' >
                                      <attribute name='objectid' alias='objectid' />
                                      <link-entity name='team' from='teamid' to='principalid' link-type='inner' >
                                        <link-entity name='teamtemplate' from='teamtemplateid' to='teamtemplateid' >
                                          <attribute name='teamtemplatename' />
                                        </link-entity>
                                        <link-entity name='teammembership' from='teamid' to='teamid' link-type='inner' intersect='true' >
                                          <link-entity name='systemuser' from='systemuserid' to='systemuserid' link-type='inner' >
                                            <attribute name='fullname' />
                                         </link-entity>
                                       </link-entity>
                                      </link-entity>
                                      <filter type='and'>
                                       <condition attribute='objectid' operator='eq' value='GUID_OF_THE_RECORD' />
                                        </filter>  
                                    </link-entity>
                                  </entity>
                                </fetch>";

      EntityCollection entColAccessTeamMembers = iService.RetrieveMultiple(new FetchExpression(strFetchXML));
}

Hope this helps.

--
Happy CRM'ing

Gopinath

Tuesday, 1 December 2015

Arabic Language Pack For Microsoft Dynamics CRM 2015

Hi,

I am working on Saudi Country CRM project. As their language is Arabic, they wanted to see CRM in Arabic language.

I thought, it would be damn easy to get the language pack and install it. But unfortunately, I could not find the Arabic language pack.


Don't waste your time like me, here is the direct link to get Arabic Language Pack.

https://www.microsoft.com/ar-sa/download/details.aspx?id=45014

Hope this helps.

--
Happy CRM'ing

Gopinath

Sunday, 15 November 2015

Allow only numbers in a text box

Hi,

In most of web applications, we get requirement to allow only number in a textbox.

Here is the JavaScript for it, just call this method onKeyPressv Event.

<HTML>
   <HEAD>
   <SCRIPT language=Javascript>
      <!--
       function isNumberPressed(evt) {
           var charCode = (evt.which) ? evt.which : event.keyCode
           if (charCode > 31 && (charCode < 48 || charCode > 57))
               return false;
           return true;
       }
      //-->
   </SCRIPT>
   </HEAD>
   <BODY>
      <INPUT id="txtChar" onkeypress="return isNumberPressed(event)" type="text" name="txtChar">
   </BODY>
</HTML>
 
Hope this helps.

--
Happy Coding
Gopinath

Saturday, 14 November 2015

This workflow job was canceled because the workflow that started it included an infinite loop.

Hi,
 
In CRM, Workflow is one of the amazing things. If our workflow calls itself (on the same entity) more than 7 times in an hour, the 8th instance will fail with the below error.
 
"The error is triggered because, by default, CRM only allows for up to eight nested child workflows. When you attempt to run more, CRM will recognize it as an infinite loop and throw error message."
 
CRM has a limit for this depth. This can seen in MSCRM_Config database by executing the following query.

SELECT * FROM
       DEPLOYMENTPROPERTIES
WHERE
       COLUMNNAME = 'MessageProcessorMaximumDepth'

If we have really strong requirement that workflow should be called more than 8 times then we can update the value in the Database using the following update query.
 
UPDATE DEPLOYMENTPROPERTIES
SET INTCOLUMN = <Number>
WHERE COLUMNNAME = 'MessageProcessorMaximumDepth'

After updating, make sure you reset IIS so that new value will be considered by CRM. 

Note: This is unsupported, it may cause issue when you upgrade the CRM system to newer versions.
 
Hope this helps.
 
--
Happy CRM'ing

Gopinath 

IsRegularActivity in CRM 2011/2013/2015

There are lots of activity types which don't look like regular activities, such as
 
Case Resolution
Bulk Operation
Opportunity Close

Quote Close
 
CRM creates activities when a Case/Opportunity/Quote is closed.
 
Go to Advanced Find and check the below.
Results
 
The field IsRegularActivity on the Activity Pointer entity is set to no for CRM created Activities.
Results

To know more about Activities check the below post

Activity Pointer and Activity Type Code in CRM 2011/2013/2015

Hope this helps.
 
--
Happy CRM'ing

Gopinath

Activity Pointer and Activity Type Code in CRM 2011/2013/2015

CRM has lots of different activities

1) Phone Call
2) Task
3) Letter
4) Email
5) Appointment
6) Fax
7) Custom Activities

 
In CRM, all the activities are saved in ActivityPointer table. This way, we can retrieve all activities with one request instead of multiple transactions.
 
Whenever you create an activity record in Microsoft Dynamics CRM, a corresponding activity pointer record is created. This implies that the activity record and the corresponding activity pointer record have the same value for the ActivityId attribute. For example, if you create an Email record, the attribute values of Email.ActivityId and the corresponding ActivityPointer.ActivityId will be the same.
 
We can differentiate the activities by Activity Type Code.

Value
Label
4201
Appointment
4202
Email
4204
Fax
4206
Case Resolution
4207
Letter
4208
Opportunity Close
4209
Order Close
4210
Phone Call
4211
Quote Close
4212
Task
4214
Service Activity
4251
Recurring Appointment
4401
Campaign Response
4402
Campaign Activity
4406
Bulk Operation

Hope this helps.
 
--
Happy CRM'ing
Gopinath