Dynamics CRM 错误“如果货币字段中存在值,则需要货币” 将 Activity 转换为 Case 后
我们有一个 Dynamics CRM 4.0 实例,在案例实体和所有活动实体(电子邮件、电话等)上具有一些“金钱”类型的自定义属性。当我使用内置的“将活动转换为案例”功能时,我发现即使创建它的活动确实有货币集,生成的案例也没有货币集。 每当打开箱子时,用户就会收到以下 JavaScript 错误:
如果货币字段中存在值,则需要货币。 选择一个 货币并重试。
这非常烦人! 我如何解决它? 有什么办法可以设置货币吗? 它需要同步完成,因为案例在从活动创建时会立即打开。 因此,即使我启动了设置货币的工作流程,用户仍然会至少收到一次该错误。 或者,我可以以某种方式抑制警告吗? 我并不真正关心设置货币,我只是希望错误消失。
We have a Dynamics CRM 4.0 instance with some custom attributes of type "money" on the Case entity and on all Activity entities (Email, Phone Call, etc.) When I use the built-in "Convert Activity to Case" functionality I find that the resulting Case does not have a Currency set, even if the Activity it was created from does have it. Whenever the case is opened the user then gets this JavaScript error:
A currency is required if a value exists in a money field. Select a
currency and try again.
This is extremely annoying! How do I fix it? Is there any way I can set the currency? It needs to be done synchronously, because the Case is opened immediately when it's created from an Activity. So even if I started a workflow to set the currency the user would still get that error at least once. Alterntatively, can I just suppress the warning somehow? I don't really care about setting the Currency, I just want the error gone.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我想这段代码会对下一个遇到同样问题的人有所帮助。
我花了一整天的时间来弄清楚我在下面做了什么。
这里涉及两个步骤:
这是代码示例。
I guess this code will be helpful for next person who have a same problem.
I spent whole day to figure out what I did below.
There are two steps involved here:
Here is the code sample.
这个恼人的问题在我的系统上得到了解决,方法是发现用于美元的 transactioncurrencyid,然后更新所有现有实体记录的实体数据库表中的 transactioncurrencyid 列。 完成此操作后,我能够在实体表单上添加货币值,没有进一步的问题。 不确定这个解决方案是否适合每个人,但因为我不想编写代码来执行此操作,并且觉得我不必这样做,因为如果我向新定义的实体添加货币属性,则不需要编写代码我的部分是填充 transactioncurrencyid 字段 - 它只是默认执行的。 总而言之,只有当将货币字段添加到具有与其关联的现有数据的现有实体时,才会出现此问题。
This annoying issue was resolved on my system by discovering the transactioncurrencyid used for US dollars and then updating the transactioncurrencyid column in the entity's database table for all the existing entity records. After doing this I was able to add money values on the entity form with no further problems. Not sure if this solution would be ideal for everyone, but as I did not want to write code to do this and felt I shouldn't have to since if I added money attributes to a newly defined entity it didn't require writing code on my part to populate the transactioncurrencyid field - it just did it by default. So in summary, this problem only seems to occur if the the money fields are added to an existing entity that has existing data associated with it.
如果您的表单上有货币字段,CRM 需要知道要使用哪种货币。 验证您的用户首选项中是否设置了默认货币(从主页“个性化工作区”,然后“常规”选项卡)。 也就是说,您的每个用户都需要设置默认货币。
我还可以通过将货币字段添加到表单中、默认为美元,然后隐藏该字段来解决此问题。 不过,如果没记错的话,这并不理想,因为美元货币是系统中的记录,并且在不同的环境中可以有不同的 GUID。
If your form has a money field on it, CRM needs to know which currency to use. Verify that a default currency is set in your user preferences (Personalize Workplace from the main page, then the General tab). That is, each of your users will need to have a default currency set.
I have also been able to work around this issue by adding the currency field to the form, defaulting it to US dollars, and then hiding the field. If memory serves, though, this isn't ideal because the US dollars currency is a record in the system and can have different GUIDs in different environments.
您可能想查看这篇文章 CRM 4 货币计算 作者:Mitch Milam
更新:经过谷歌搜索后,我发现您可能需要在某处设置 transactioncurrencyid 查找。 因此,在您的情况下,它可能是 onsave 或在工作流代码的执行中。 我从这里读到的 错误:为 CRM 4.0 货币字段分配十进制值使用 JavaScript
You might want to check out this article CRM 4 Currency Calculations by Mitch Milam
Update : After googling around, i found out that you might need to set the transactioncurrencyid lookup somewhere. So in your case, it might be onsave or inside the execution of the workflow codes. I read it from here Error: Assign a decimal value to CRM 4.0 money field using Javascript
在“个性化工作区”的“常规”选项卡中设置默认货币
新记录将使用此货币
对于现有记录(添加货币字段之前),使用高级查找查找没有货币值的记录,然后使用批量编辑设置货币
set default currency in Personalize Workspace, General tab
NEW records will use this currency
For EXISTING records (before money field(s) added) use Advanced Find to find records with NO currency value, then use Bulk Edit to set currency
由于当我在寻找 CRM 2011 问题的解决方案时,此主题出现在我的 Google 搜索中,因此我想添加我的博客文章,解释如何使用 JavaScript 在 CRM 2011 表单的 Onload 中设置默认货币查找、JSON 和 OData。
http://crmscape.blogspot.com/2011/03 /crm-2011-set-default-transaction.html
Since this thread came up in my Google search when I was looking for a solution to this problem for CRM 2011, I thought I'd add my blog article explaining how to set the default currency lookup in the Onload of a CRM 2011 form using JavaScript, JSON and OData.
http://crmscape.blogspot.com/2011/03/crm-2011-set-default-transaction.html
我同意 Hadi Teo 的观点,您需要设置 transactioncurrencyid。 自从我遇到这个以来已经有一段时间了 - 所以这就是我想我记得的。
如果您创建一个填充了货币字段的新实体,则会设置交易货币。
如果您更新实体,则不会设置交易货币字段。
我还没有使用过 Activity to Case 功能,所以我不太确定它的作用。 您可以做的一件事就是将 transactioncurrencyid 添加到表单中。 然后您可以在修改案例之前对其进行设置。
另一种是在代码中默认货币。 有两个地方可以确定默认货币。 首先是用户设置。 第二个(如果为空)关闭组织设置。
I agree with Hadi Teo that you need to set the transactioncurrencyid. Its been awhile since I ran across this - so here is what I think I remember.
If you create a new entity with a money field populated the transaction currency will be set.
If you update an entity, the transaction currency field will not be set.
I haven't used the Activity to Case function so I'm not all that sure what it does. One thing you can do as a work around is to add the transactioncurrencyid onto the form. Then you can set it before you modify your Case.
The other would be to default the currency in code. There are two places to determine the default currency. First off of the user settings. Second (if that is null) off of the organization settings.
修复此问题
1. 将基础货币字段也添加到表单中。
2. 取消勾选基础货币字段的“默认可见选项”。
Fix for this problem
1. Add the base currency field also to the form.
2. Untick the "visible by default option" of the base currency field.