简体   繁体   中英

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. On Entity c there is a given field which value I want to return.

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 ).

I see two workarounds:

  1. Add an OutArgument<string> and store a serialized EntityReference object in it. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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