如何根据查找实体替换联系人实体中的规范化职位
各位,
我正在使用 MSCRM 4,并且我有一个具有实际职位名称和规范化职位名称字段的联系人实体。我想根据实际职称填充标准化职称字段。我创建了一个单独的实体,它是一个将规范化职位与实际职位相关联的表,例如,行政 CFO 等于 CFO。我想这需要通过加载或保存脚本来完成,但我不知道如何做到这一点。
任何帮助将不胜感激
问候
乔(苏格兰)
Folks,
Im using MSCRM 4 and I have a contact entity with an actual job title and a normalized job title field. I would like to populate the normalized job title field based on the actual job title. I created a seperate entity which is a table that corelates the nomalized job title with the actual job title eg Administrative CFO equals CFO. I guess this needs to be done via an on-load or on-save script But I cant figure out how to do it.
Any help would be much appreciated
Regards
Joe ( Scotland)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您当然可以使用 OnSave javascript 事件来执行一些 AJAX 魔法并查找标准化作业。这种方法的问题在于,如果您导入联系人,或者使用 Web 服务从另一个工作流程或实用程序创建联系人,则该 javascript 显然不会被执行。
您的下一个选择是插件或工作流程。我个人会在这里使用工作流程,因为标准化的职位名称可以异步更新,而且我发现自定义工作流程活动更容易编程。
以下链接可帮助您构建自定义工作流程活动:
http://msdn.microsoft.com/en-us/library/cc151142。基本上
,您将构建一个具有一个字符串输入和一个字符串输出的自定义工作流活动。输入称为“职位名称”,输出称为“标准化职位名称”。在 Execute 方法中,您将使用 CRM Web 服务根据输入的职位名称查找规范化的职位名称,然后设置输出属性。
回到 CRM,您将创建一个新的工作流程,该工作流程在创建时或职位字段更改时触发。作为第一步,您将添加新的自定义活动,并传入联系人的职务。第二步是对联系人的正常更新步骤,将规范化职位设置为步骤 1 的输出。
希望有帮助!
You certainly could use an OnSave javascript event to do some AJAX magic and lookup the normalized job. The problem with this approach is that if you ever import contacts, or create contacts from another workflow or utility using the webservices, that javascript obviously won't be executed.
Your next option is a Plugin or a Workflow. I personally would use a workflow here since it is probably ok for the normalized job title to be updated asynchronously, and I find that custom workflow activities are a bit easier to program.
Here's a link to help you build a custom workflow activity:
http://msdn.microsoft.com/en-us/library/cc151142.aspx
Basically, you'd build a custom workflow activity that has one string input and one string output. The input would be called "Job Title" and the output would be "Normalized Job Title". In the Execute method, you'd use the CRM webservices to go look up the normalized job title based on the input job title, and then set the output property.
Back in CRM, you'd create a new Workflow that gets triggered on create or when Job Title field changes. You'd add your new custom activity as the first step, passing in the Contact's Job Title. The second step would be a normal Update step to the Contact, setting the Normalized Job Title to the output of step 1.
Hope that helps!