How should i know which property comes under InputParameters Based on Message Request in Dynamics crm Plugin?

半世苍凉 提交于 2019-12-11 17:48:08

问题


CreateRequest Message is named Target,which is of type Entity.But not all Request contain a Target property is of type Entity.

For Example AssociateRequest InputParameter contains Relationship is of type Relationship.

For Example AddItem message will return which property?How should I know there are so many messages in plugin registration tool.how should I know which message has what property it will return.

it was only possible with Debugging?


回答1:


I agree there so many messages, but I had this below file with my, while developing plugin and I look for the type of Input parameter first

I got this file from http://patrickverbeeten.com/Blog/2008/01/25/CRM-40-Plug-in-message-input-parameters

But I have tried to update this file somewhat for CRM 2011:

Please download file from:
http://tempsend.com/4C08EE4EA9




回答2:


If I understand your question correct you can just do the following:

if (context.InputParameters.Contains("Target")) {
   // Do something with Target
}
else if (context.InputParameters.Contains(“Relationship”)) {
   // Do something with Relationship
}

If you want to confirm that Target is of Entity (I think it always is in the plugin) then I would think you could just do the following:

if (context.InputParameters["Target"].GetType() == new Entity().GetType()) {

}


来源:https://stackoverflow.com/questions/24545934/how-should-i-know-which-property-comes-under-inputparameters-based-on-message-re

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!