Creating Tasks

<< Click to Display Table of Contents >>

RayFlow PowerShell API > 7.3 > Implementation Guide > Working with RayFlow PowerShell API 

Creating Tasks

Creating a new task is a 2-step process:

 

1.Use New-RayFlowOrder command to create a stub

2.Publish it to RayFlow using Publish-RayFlowOrder

 

Between step 1 and 2 it is possible to change datafields of the new package, by using the indexer syntax (square brackets, see below).

 

During the second step, your input is going to be validated. For example, if you forget to set a required data field, you will get a warning and the task will not be created.

 

A simple example that adds a new package may look like this:

 

$order = New-RayFlowOrder -Project $projects[0] -Category REGULAR # The only place where category can be changed!
### Now change the values

$order["Application name"] = "My name"

$order["Application vendor"] = "My vendor"

$order["Application language"] = "ENG"

$order["Application version"] = "2.0"

$addedtask = Publish-RayFlowOrder -Order $order

 

Publish-RayFlowOrder returns an ordinary task which you can further pipe to other commands, see its properties etc.

 

If validation fails due to missing or wrong data field format, a warning is shown, for example:

 

$order = New-RayFlowOrder -Project $projects[0] -Category REGULAR # The only place where category can be changed!
### Now change the values, but "forget" about one required...

$order["Application name"] = "My name"

$order["Application vendor"] = "My vendor"

$order["Application language"] = "ENG"

### $order["Application version"] = "2.0" This property is required, so let's see what happens now...

$addedtask = Publish-RayFlowOrder -Order $order
WARNING: [Application version]: This field is required

 

 

papercliper

Note:

The only way to define Category, Schedule and Task type is when using New-RayFlowOrder command let. After a stub of an order is there, you cannot change it and you must create a new object instead.