Let’s discuss the tips given by a Microsoft Dynamics CRM Services team to solve “A currency is required if a value exists in a money field. Select a currency and try again”
The above error is common. Recently I got the above error when I am trying to set the amount field in the forms. The reason behind that I am setting Currency lookup using JavaScript in the form on load. Then I am going to set an amount field manually with a certain value.
Here is my code to set currency lookup:
And when I fill the amount field, I could not see any currency prefix in the field. So, I got the below screenshot error.
The behavior I have seen is that when we set currency lookup manually, I can see the currency symbol/prefix correctly. So, I realize that something happening internally when I set currency lookup manually.
Here you can see when I set value currency fields it automatically set the currency symbol here in the field and its expected behavior.
I am a bit surprised at how to get rid of this issue. I don’t want the user to set currency lookup manually and I found some unsupported way to set the currency symbol in the amount field. Then I thought that I would go with business rules to set the currency lookup, but I got the same error. So, business rules will not help us in this scenario.
Now we have left other two other options either plugin or workflow. First I moved ahead with workflow and I create a workflow to set the currency lookup while saving, and it’s working fine for me. But there is a problem, as you know if you have multiple environments with multiple currencies and currency lookup GUID may not be the same for the entire environment. So, if I set currency lookup using the workflow you need to make sure that the entire environment should be the same currency lookup GUID to work with workflow.
In my case, I checked that I had a different currency GUID for the same currency in a different environment. So, I decided to go with the plugin. The plugin I register in Create event Pre-operation to avoid the additional update. Here is what my plugin looks like –
Screenshot of plugin steps -
In summary, when you have any currency type field in your form and if your application support multiple currencies make sure you set currency lookup value for the user manually or server-side using a plugin or workflow otherwise you may face this kind of issue.