简体   繁体   English

Microsoft Dynamics CRM 2011最佳解决方案,用于更改实体的字段数据类型

[英]Microsoft Dynamics CRM 2011 best solution to change entity's field data type

I'm having an issue on changing data type of a field in Dynamics CRM 2011 On Premise deployment. 我在Dynamics CRM 2011 On Premise部署中更改字段的数据类型时遇到问题。 In my managed solution, name it "Solution 1", I have a custom field in contact entity: "new_usernumber" of type number (int). 在我的托管解决方案中,将其命名为“解决方案1”,我在联系人实体中有一个自定义字段:类型为number(int)的“new_usernumber”。 I want to change it to string as per new client's requirement (for new users they want to add prefix to it). 我想根据新客户的要求将其更改为字符串(对于他们想要为其添加前缀的新用户)。 I can uninstall the solution and deploy the new "fixed" managed solution, but this requires me to delete the value on my custom fields. 我可以卸载解决方案并部署新的“固定”托管解决方案,但这需要我删除自定义字段上的值。 Is there any better solution for this? 有没有更好的解决方案呢?

TIA TIA

There is no easy way to do this. 没有简单的方法可以做到这一点。 If you don't already have data deployed in the instance using the managed solution I recommend deleting it and importing a corrected managed solution file. 如果您尚未使用托管解决方案在实例中部署数据,我建议将其删除并导入已更正的托管解决方案文件。

There is no supported or unsupported process of changing the data type(or logical name) of a field without data loss. 没有支持或不支持的更改字段的数据类型(或逻辑名称)而没有数据丢失的过程。 What you will need to do is add the new field and then write a quick update utility to copy the data from the old field to the new field. 您需要做的是添加新字段,然后编写快速更新实用程序以将数据从旧字段复制到新字段。

Here is a great article on exactly how to pull off deleting a field in a managed solution. 这是一篇关于如何在托管解决方案中删除字段的精彩文章 Note, if you are trying to preserve data you'll need to run the update after the step "Import devkeydetDeleteExample_1_1_HOLDING.zip" 请注意,如果您尝试保留数据,则需要在“导入devkeydetDeleteExample_1_1_HOLDING.zip”步骤后运行更新。

Have fun...this is a pain, but certainly doable! 玩得开心......这是一种痛苦,但肯定是可行的!

A few months ago I recreated fields in a solution (from double to int ). 几个月前,我在一个解决方案中重建了字段(从doubleint )。 That was a huge mistake. 这是一个巨大的错误。 I'm still not sure where things went wrong but they did go wrong. 我仍然不确定出了什么问题,但他们确实出了问题。 Not only did I lose the date. 我不仅失去了约会。 I managed to introduce errors in the meta-layer so our MVP had to sit dear help me get it running again. 我设法在元层中引入错误,所以我们的MVP必须亲爱的帮助我让它再次运行。 He wasn't happy. 他不开心。 I wasn't happy. 我不高兴。 The customer wasn't happy (ex-customer today, mostly because of that). 客户不满意(今天的前客户,主要是因为这一点)。

So, my humble advice - don't do that. 所以,我谦虚的建议 - 不要这样做。 Declare a new field instead. 而是声明一个新字段。 If you have usernumber , keep it but start using userNumberString (or userString , userName etc.). 如果你有usernumber ,请保留它但开始使用userNumberString (或userStringuserName等)。 My guess is you'll keep your hair longer that way. 我的猜测是你会保持你的头发长一点。

And if you manage to succeed, please do tell. 如果你成功了,请告诉我们。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM