locked
Crm 4.0 Money problems? Use Float instead after deleting and recreating your entity. RRS feed

  • Question

  • In the Crm 4.0 VHD create a new entity. Add a money attribute. 4 new attributes are added; 3 by the system.  Delete the money attribute ( the one without (base) after its name ). Try to delete the other 3 attributes. You cannot.  Message: you cannot delete a system attribute. Publish. Open the default form.  Try to enter and save a new object. Exception: object reference not set to an instance of an object. 

     

    Check in Event Viewer: 

     

     

    Event Type: Error
    Event Source: MSCRMWebService
    Event Category: None
    Event ID: 18176
    Date:  09-May-08
    Time:  14:22:25
    User:  N/A
    Computer: MOSS
    Description:
    Web Service Plug-in failed in OrganizationId: 00b573ed-1d22-4ef7-8db1-6016caa1eb35;
    SdkMessageProcessingStepId: f6d4ebbb-0075-407d-8208-26575bfa39af;

    EntityName: new_seminarattendance;

    Stage: 20; MessageName: Create; AssemblyName: Microsoft.Crm.ObjectModel.MultiCurrencyPlugin,
    Microsoft.Crm.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.ObjectModel.MultiCurrencyPlugin;

    Exception: Unhandled Exception: System.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)
    .

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    Friday, May 9, 2008 5:05 AM

Answers

  •  

    It turns out in a multi-currency environment, if you create a money attribute on an entity, that entity must always from that point forward have a money attribute.

     

    It doesn't have to be on the form though and it doesn't matter what the name is.

     

     

    Thursday, May 22, 2008 9:49 PM
    Moderator

All replies

  • Don't be concerned--the system is acting the way it should.  The additional attributes you see are because of the multi-currency capabilities.  It doesn't cause any problems. 

     

    The only thing I've come across that you need to be aware of is that whenever you include a money field in a view of a related entity, you also need to include the currency attribute from that entity in your view (even if you are only using one currency), otherwise you will get an error.

     

     

    Saturday, May 10, 2008 11:28 AM
    Moderator
  • So how do you fix this, once the damage has been done??

     

    Thursday, May 22, 2008 7:18 PM
    Moderator
  •  

    If you are doing this in the Microsoft CRM VHD, why don't you just set up a new copy and import customizations, except for the one that deleting the attribute messed up.  Also, is there a problem with leaving the attribute there, but not displaying it on the form?
    Thursday, May 22, 2008 7:46 PM
    Moderator
  • It's not the VHD.  I found this post because I ran into the problem on an actual server.

     

    I don't have any record of how this happened or what caused it but the error looks pretty close to identical.  Also, the symptoms are the same.  I get an "object not set to an instance .... " error when I try to create a new instance of the entity.  So now I am just trying to figure out what the quickest fix is to this problem.  I am trying to avoid recreating the entity altogether if it is possible.

     

     

    Web Service Plug-in failed in SdkMessageProcessingStepId: {F6D4EBBB-0075-407D-8208-26575BFA39AF}; EntityName: new_govtcontract Stage: 20; MessageName: Create; AssemblyName: Microsoft.Crm.ObjectModel.MultiCurrencyPlugin, Microsoft.Crm.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.ObjectModel.MultiCurrencyPlugin; Exception: Unhandled Exception: System.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)

     

     

     

    Thursday, May 22, 2008 8:06 PM
    Moderator
  • OK, I misunderstood.  I thought you were the originator of the post.  I would start a different thread for your question.--this question was regarding the attributes that are created behind the scenes in 4.0 when you add a money field.  In that case, there was nothing wrong.

     

    One thing you might want to verify is if the currency field is displayed on the form or view that is giving you headaches.  We found that especially with views that reference other entity information, if a money field is present, the currency field from that entity must be present.

     

    Make sure that the currency field is displayed on the form.

    Thursday, May 22, 2008 8:27 PM
    Moderator
  •  

    Currently there is no currency field, I don't know what it used to be called either.  I only have seen the symptoms after the fact.

     

     

    Thursday, May 22, 2008 8:42 PM
    Moderator
  •  

    Just for kicks, add the currency field to the form (schema name transactioncurrencyid).  Not saying it will solve your problems, but I have seen errors in 4.0 if it is not present.

     

    If it doesn't exist, maybe something got messed up with your money attribute.

     

     

    Thursday, May 22, 2008 8:52 PM
    Moderator
  • I have no actual evidence that a money attribute was ever present.  I already added the

    transactioncurrencyid attribute to the form and it didn't help the problem.

    Thursday, May 22, 2008 9:17 PM
    Moderator
  •  

    It turns out in a multi-currency environment, if you create a money attribute on an entity, that entity must always from that point forward have a money attribute.

     

    It doesn't have to be on the form though and it doesn't matter what the name is.

     

     

    Thursday, May 22, 2008 9:49 PM
    Moderator
  • wow--makes sense, I guess.  How did you figure that out?

    Thursday, May 22, 2008 9:55 PM
    Moderator
  • I actually contact MSFT support and they knew right away what the problem was.  They should get the word out about this one as they also said that they DO NOT intend to fix this bug.

     

     

    Friday, June 13, 2008 10:49 PM
    Moderator
  • Many thanks for that. Caused me no end of problems.

     

    Monday, June 30, 2008 5:11 PM
  • What if the entity in question is a contact and /or an account?.. I have this problem for a new organization, on a multitenant server. I get the error every time I try to create/update a contact or account. I tried the money attribute trick, but it didn't work (and, of course, those entities already have money attributes which I didn't delete).

    Any suggestions?

    Thank you

    Saturday, April 10, 2010 9:51 AM