开发者

how can I Replace a normalize job title in a contact entity based on a lookup enity

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 core开发者_StackOverflow中文版lates 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)


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜