I had not done a workflow for objects of an indefinite type before, however you could modify this code to do this; This is for link to contact:
[RequiredArgument]
[Input("Contact")]
[ReferenceTarget("contact")]
public InArgument<EntityReference> Contact { get; set; }
protected override void Execute(CodeActivityContext context)
{
ContactReference = Contact.Get(context);
if (ContactReference == null)
throw new InvalidPluginExecutionException("Contact reference is null.");
DoSomething();
}
, , . , ReferenceTarget, . , LogicalName .Get(), :
string entityType = ContactReference.LogicalName;