Run a Workflow (.NET 4) from the ABL?

Posted by Simon de Kraa on 03-Nov-2010 13:52

I would like to run a workflow from the ABL.

Is it possible to translate the following C# to ABL?

The main code calling the workflow:

using System;
using System.Linq;
using System.Activities;
using System.Activities.Statements;
using System.Collections.Generic;

namespace WorkflowConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      var wf = new Workflow1();

      IDictionary<string, object> outputs = WorkflowInvoker.Invoke(wf);
      Console.WriteLine(outputs["greeting"]);
    }
  }
}


Part of the workflow xaml file itself where the output parameter "greeting" is either "Good morning" or "Good afternoon" based on the time.

<If Condition="[DateTime.Now.Hour &lt; 12]">
  <If.Then>
    <Assign>
    <Assign.To>
      <OutArgument x:TypeArguments="x:String">[greeting]</OutArgument>
    </Assign.To>
    <Assign.Value>
      <InArgument x:TypeArguments="x:String">Good morning</InArgument>
    </Assign.Value>
    </Assign>
  </If.Then>
  <If.Else>
    <Assign>
    <Assign.To>
      <OutArgument x:TypeArguments="x:String">[greeting]</OutArgument>
    </Assign.To>
    <Assign.Value>
      <InArgument x:TypeArguments="x:String">Good afternoon</InArgument>
    </Assign.Value>
    </Assign>
  </If.Else>
  </If>

All Replies

Posted by Peter Judge on 03-Nov-2010 14:38

The code should look something like the below . Note that you will need to add refences in your assemblies.xml file for the workflow stuff.

using System.*.

using System.Linq.*.

using System.Activities.*.

using System.Activities.Statements.*.

using System.Collections.Generic.*.

class Program:

  constructor public Program():

      def var wf as Workflow1.

      wf = new Workflow1().

      def var outputs as " System.Collections.Generic.IDictionary".

          outputs = WorkflowInvoker:Invoke(wf).

      message

         outputs["greeting"]

          .

  end constructor.

end class.

-- peter

Posted by Simon de Kraa on 03-Nov-2010 18:09

Thanks.

I'm having problems with the "Workflow1" definition.

I have set the output type of the project to class library so a dll file is produced.

But when I try to add the dll to the assemblies.xml file using the AR tool I get the error message: "Not a valid assembly".

The workflow project template that I have chosen is a "Workflow Console Application" which I am not convinced it is the right one.

But the other options are:
- Activity Designer Library
- Activity Library
- WCF Workflow Service Application

And I don't think they are the right ones either.

Any ideas?

Posted by Admin on 03-Nov-2010 23:17

I think the biggest challenge is the fact that it's a .NET 4.0 assembly. Any chance to build a .NET 3.5 assembly? Also, can you create the Workflow1 class in a namespace? AFAIK Progress does not like classes without a namespace.

Posted by Simon de Kraa on 04-Nov-2010 05:22

Well, I can set the "target framework" to 3.0 or 3.5 but then I get some reference errors.

I will have a look at it. Thanks.

I was wondering if you could use Microsoft Workflow Foundation for:

- Calling workflows from the ABL (using the method above)

- Calling ABL from the workflows (using webservices)

Then you could use WF for modelling the business processes in your application.

Without actually coding any business logic "components"; only the flow...

I am note sure if:

- WF is part of a default .NET framework installation (no runtime license costs)

- The WF visual designer is part of the VS express edition (no development license costs)

All assuming you are running MS Windows of course.

Posted by Simon de Kraa on 10-Nov-2010 12:29

When will .NET 4 be supported.................

Posted by bdearborn on 10-Nov-2010 12:32

Hi,

I am currently out of the office on business and will be returning to

the office on November 12. If you need immediate assistance please

call my cell phone at 503-805-8598.

Thanks,

Bryn Dearborn

503-805-8598

--

Bryn Dearborn

503-928-8115 (Work)

503-805-8598 (Cell)

Cornerstar

Posted by Thomas Mercer-Hursh on 10-Nov-2010 13:18

I would guess 11.0.  During the taping of the Exchange talks in August Shelley mentioned that they were due to switch their nightly builds to 4.0 that weekend, so we know they are trying ...

This thread is closed