locked
Object reference not set to an instance of an object RRS feed

  • Question

  • Hi all,

    I have a custom entity. I delete several of its attributes, and one of them is money type. When I create a new record of the custom entity, it gives an error message "Object reference not set to an instance of an object."

    I use CRM Diag Tool and I copy the message on below of this post. Does the error relates with the money type attribute that I deleted? Because the error tells something about CalculateBaseMoney etc.

    Thanks for any help.

    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: Exception has been thrown by the target of an invocation.
    Error Number: 0x80040265
    Error Message: Object reference not set to an instance of an object.
    Error Details: Object reference not set to an instance of an object.
    Source File: Not available
    Line Number: Not available
    Request URL: http://tsatest-win2008.mitraistest.com:5555/HeartFoundation/userdefined/edit.aspx?etc=10003
    Stack Trace Info: [NullReferenceException: Object reference not set to an instance of an object.]
    at Microsoft.Crm.ObjectModel.CalculateBaseMoney.ProcessCalculatedColumns(DynamicEntity entity, BusinessEntity entityPreImage, EntityMetadata entityMetadata, String exchangeRateFieldName, Boolean isCreateOperation, ArrayList unchangedAttributes)
    at Microsoft.Crm.ObjectModel.CalculateBaseMoney.Execute(EntityDataInformation entityDataInformation)
    at Microsoft.Crm.ObjectModel.MultiCurrencyPlugin.Execute(IPluginExecutionContext context)
    at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)
    Tuesday, January 12, 2010 3:50 AM

Answers

  • Hi

      

    If you have an entity that contains a ‘Money’ attribute and you delete them all because they are not longer needed you will end up with an error every time you open the entity and try and save it.

    There is a work around if you ever get the error or to stop it from happening.

     

    ·         Delete all the ‘Money’ attributes

    ·         Create a new ‘Money’ attribute and call it ‘Do Not Use’

    ·         Make it not searchable so it cant be found in advanced find

     

    This link is Microsoft’s KB article on the issue

     

    http://support.microsoft.com/kb/954018/en-us

     

    This link tells you how to correctly delete the ‘Money Attribute’

     

    http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/19d589d9-5d39-47aa-b106-fc1f09caf1a2

     

     

    This will not affect any entity’s that have never had a ‘Money’ attribute added to it so it seems that when a ‘Money’ attribute is added to a entity it is enabling something that can not be disabled again.

     

    Thanks
    Ranjit


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by ckeller Tuesday, January 12, 2010 8:18 AM
    • Marked as answer by Astri Kusumawardani Tuesday, January 12, 2010 9:12 AM
    Tuesday, January 12, 2010 7:50 AM

All replies

  • This problem is resolved when I created one attribute with type Money. But still I don't quite understand why there must be an attribute with money type.
    Tuesday, January 12, 2010 4:08 AM
  • Hi,

    I can guess that you have deleted money attribute but not its base attribte( As when you create a money attribte system created one yourattributename_base to store value in base currency) so you got this error.


    Mahain
    Tuesday, January 12, 2010 6:49 AM
    Moderator
  • If you deleted the attribute from within CRm and not using some backend script, the error you were getting can not be attributed to deletion of the money attribute. Are there plugins on pre or post create event, if so please check if there is no remaining reference to the deleted attribute.


    AKS
    Tuesday, January 12, 2010 7:08 AM
  • Hi

      

    If you have an entity that contains a ‘Money’ attribute and you delete them all because they are not longer needed you will end up with an error every time you open the entity and try and save it.

    There is a work around if you ever get the error or to stop it from happening.

     

    ·         Delete all the ‘Money’ attributes

    ·         Create a new ‘Money’ attribute and call it ‘Do Not Use’

    ·         Make it not searchable so it cant be found in advanced find

     

    This link is Microsoft’s KB article on the issue

     

    http://support.microsoft.com/kb/954018/en-us

     

    This link tells you how to correctly delete the ‘Money Attribute’

     

    http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/19d589d9-5d39-47aa-b106-fc1f09caf1a2

     

     

    This will not affect any entity’s that have never had a ‘Money’ attribute added to it so it seems that when a ‘Money’ attribute is added to a entity it is enabling something that can not be disabled again.

     

    Thanks
    Ranjit


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by ckeller Tuesday, January 12, 2010 8:18 AM
    • Marked as answer by Astri Kusumawardani Tuesday, January 12, 2010 9:12 AM
    Tuesday, January 12, 2010 7:50 AM