[英]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: 我看到两个解决方法:
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. 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.