简体   繁体   English

具有通用类型的MS CRM自定义工作流活动输出

[英]MS CRM Custom Workflow Activity output with generic type

I would like to write a Custom Workflow Activity which will return a value from a parent object from the parent object of an entity. 我想编写一个自定义工作流活动,该活动将从实体的父对象的父对象返回一个值。 For example I am on Entity A here I have a lookup field to Entity B and here I have a lookup field to Entity c. 例如,我在实体A上,这里我对实体B有一个查找字段,在这里我有对实体c的查找字段。 On Entity c there is a given field which value I want to return. 在实体c上有一个给定的字段,我想返回该值。

Is it possible to make a generic output type, so that the Custom Workflow Activity can either return a lookup or any other supported datatype? 是否可以创建通用输出类型,以便“自定义工作流活动”可以返回查找或任何其他受支持的数据类型?

Thanks! 谢谢!

It is not possible to add an OutArgument<T> of any type other than the supported types (as listed on MSDN ). 除了支持的类型(如MSDN上列出)外,无法添加任何其他类型的OutArgument<T>

I see two workarounds: 我看到两个解决方法:

  1. Add an OutArgument<string> and store a serialized EntityReference object in it. 添加一个OutArgument<string>并在其中存储序列化的EntityReference对象。 Downside of this approach is that your parameter can only be consumed by another custom workflow activity. 这种方法的缺点是您的参数只能由另一个自定义工作流程活动使用。
  2. Add an OutArgument<EntityReference> for every entity type your workflow activity needs to support. 为工作流活动需要支持的每种实体类型添加一个OutArgument<EntityReference> If you are lucky you only need a few. 如果幸运的话,您只需要几个。

You can specify the type of the output argument for a custom workflow action in the following manor 您可以在以下庄园中为自定义工作流程操作指定输出参数的类型

[ReferenceTarget("Entity Logical Name")]
public OutArgument<EntityReference> ReferenceArgument { get; set; }

for more information on returning values from a Custom Workflow Action you should look at this article 有关从“自定义工作流操作”返回值的更多信息,请查看本文。

http://anythingcrm.blogspot.co.uk/2013/07/crm-2011-workflow-activity-parameter.html http://anythingcrm.blogspot.co.uk/2013/07/crm-2011-workflow-activity-parameter.html

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

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