Sofy
Sofy

Reputation: 1

passing value from activity to another in WF

I'm working with WF. I made a custom activity called Draft_Doc:

public sealed class Draft_Doc : CodeActivity<string> 
{
    protected override string Execute(CodeActivityContext context)
    {
        C.Send_Task_Msg(unique_name, "Draft");
        return "Draft";
    }
}

I made another activity that contains a bookmark.

public sealed class WaitingTheApproval : NativeActivity
{
    WorkflowInstanceProxy instance;
    Service1Client C = new Service1Client();
    public InArgument<string> previous_stage { get; set; }
    public string stageName;

    protected override void CacheMetadata(NativeActivityMetadata metadata)
    {
        base.CacheMetadata(metadata);
        metadata.AddDefaultExtensionProvider<MyExtension>(() => new MyExtension());

        //RuntimeArgument argSql = new RuntimeArgument("SqlConnectionString", typeof(String), ArgumentDirection.In);

    }

    protected override bool CanInduceIdle
    {
        get { return true; }
    }

    protected override void Execute(NativeActivityContext context)
    {

        var bookmark = context.CreateBookmark("MyBookmark", BookmarkResumed);
        var extension = context.GetExtension<MyExtension>();
        instance = extension._instance;
        stageName = context.GetValue(this.previous_stage);

        stageName = previous_stage.Get(context);
        WaitSome(bookmark);

    }
}

What I want is, when I drag and drop these two activities in rehosted workflow. I want to drag Draft_Doc first then I will link the WaitingTheApproval with it.

So, I want the return value from Draft_Doc set in the InArgument previous_stage in WaitingTheApproval at runtime. Anyhelp?

Upvotes: 0

Views: 669

Answers (1)

Saber
Saber

Reputation: 5660

There is no way to pass a value from one activity to another directly. you should assign the value to a Variable in the first activity and use the variable which has been assigned in the second activity.

Upvotes: 1

Related Questions