Microsoft Dynamics CRM 2011

Microsoft Dynamics CRM 2011

Wednesday, December 3, 2014

How to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011)

  1. In this article we see how to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011) .

    How to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011)

How to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011)




  1. This error appears in Dynamics CRM 2011 - 2013 custom Plugins or custom Workflows, or any C# code calling the Organization Web Service WCF endpoint using late binding. Specifically we're creating a new address for an Account or a Contact entity. The CustomerAddress CRM entity has a reference field which points to the "ParentId" , the Account or Contact to which belongs this new address :

    How to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011) 1
  2. The C# code above instantiates the "ParentId" field with the actual Account ID (guid) . The guid is guaranteed to contain a Value, elsewhere the code inside the brackets wouldn't be executed :
    How to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011) 2
  3. However, there is an exception raised , expressing that the value is null : the error message is misleading, since the data type of the CRM SQL column is indeed "uniqueidentifier" , therefore a Guid, which we tried to insert in the attribute:

  4. How to fix the "Attribute: parentid cannot be set to NULL" exception in Dynamics CRM 2013 (2011) 3

  5. You wouldn't imagine that that is not enough for CRM, and that it is expecting to get another Type at all: an "EntityReference" CRM type, and not just a Guid:

     
     /*  CREATE PARENT REFERENCE FOR CUSTOMER ADDRESS  */
                    EntityReference parentID = new EntityReference();                    parentID.Id = guidParentAccount.Value;                    parentID.LogicalName = "account";
                    oAccountAddress.Attributes["parentid"] = parentID;
                        /***************************************************/

                      This way you get rid of the error, giving to the CRM Organization Service exactly what it needed.
                      There is another way to write the code above, shorter, as follows:

                            /*  CREATE PARENT REFERENCE FOR CUSTOMER ADDRESS  */
                                oAccountAddress["parentid"] = new EntityReference("account", guidParentAccount.Value );                                            /***************************************************/


                                    That's all...Enjoy Dynamics CRM

                                    by Carmel Schvartzman

                                    כתב: כרמל שוורצמן







                                    Tuesday, November 18, 2014

                                    How to install Business Intelligence Development Studio (BIDS) for Visual Studio 2012 Sql Server 2008


                                    1. In this walkthrough we will learn How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 
                                    2. The Business Intelligence Development Studio (BIDS) is an add-on to Visual Studio 2012 and Sql Server 2008. The BIDS includes the SSIS - Sql Server Integration Services templates for developing SSIS projects on Visual Studio 2012. Here we'll see step by step how to install it :

                                      SSIS - Sql Server Integration Services

                                    How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 Sql Server 2008






                                    1. Browse to the Microsoft Download Center to get the Visual Studio 2012 templates for the BIDS, which also includes the SSIS - Sql Server Integration Services :

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008
                                    2. Download it to your machine and run it as administrator:

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 1
                                    3. Click the "Install" button :

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 2
                                    4. Make sure that the Business Intelligence for Visual Studio 2012 box is checked  :

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 3
                                    5. Click "Next" :

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 4
                                    6. Check that the installation has been successful :

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 5

                                       
                                    7. Now let's see how it has the Visual Studio 2012 upgraded. Before the installation, Visual Studio 2012 templates for new projects looked like this :

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 6
                                    8. Now, after the installation, the Visual Studio 2012 templates include the ones for Business Intelligence , SSIS between them:

                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 7
                                    9. Now you can create a new SSIS - Sql Server Integration Services project using the Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 :


                                      How to install Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 8

                                    10. In this walk-through we've learned how to install the Business Intelligence Development Studio (BIDS) on Visual Studio 2012 and Sql Server 2008 .
                                    11. That's all...Enjoy Dynamics CRM

                                      by Carmel Schvartzman

                                      כתב: כרמל שוורצמן