Start and Queue Activity

The Idea of these functions is to get 2 or more activities to work together. The activities can be dependent on each other on the data basis or execution priority basis.

StartActivity.SK:

StartActivity starts an activity (child) from within another activity (parent). Inputs to the child activity are provided by the parent activity and can be the result of calculations within the parent.

  • Note:

  • There is no support for file inputs.

  • As soon as StartActivity is executed, the child activity goes on the queue and may start running in parallel with the parent activity. There is no guarantee on when exactly it will start.

WaitForActivity.SK:

WaitForActivity waits until the child activity is complete and returns the status. This wait might last a long time depending on when the child activity starts running and how much time it takes to complete. The parent activity may call WaitForActivity and pass it the id returned by StartActivity.

  • Note:

  • It is used always along with the StartActivity.

  • Failure of the child activity does not cause the parent activity to fail.

QueueActivity.SK:

QueueActivity is like StartActivity except that it provides a guarantee that the child activity will start only after the parent activity finishes. This makes it possible for the child activity to depend on the effects produced by the parent activity. Unlike StartActivity, there is no possibility of using a WaitForActivity.

Activity Setup

  1. Parent Start Activity

  2. Child Activity 1 (Triggering multiple times for different inputs using WaitForActivity)

  3. Child Activity 2 (without WaitForActivity)

  4. Parent Queue Activity

  5. Child Activity 3

Development: StartActivity&WaitForActivity:

a) Child Activity 1

  • Input: A number (1,2……)

  • Output: Input + 5

b) Child Activity 2

  • Input: Any text (abc, xyz, test, prod, etc.)

  • Output: Input & “Activity”

c) Parent Start Activity

INPUTS

  • ‘Text Input’ (for Child activity 2)

  • ‘Count Input’ (for Multiple triggers of Child Activity 1)

Steps to Trigger Child Activity 1 & 2

  1. Do the operations based on the parent activity inputs.

  2. Generate inputs for child activity

  3. Setup of StartActivity.SK function:
    Sheetkraft TAB -> More TAB -> Web Actions -> Start Activity

  • StartActivity Formula:
    StartActivity.SK("test.Child Activity 1","3835920e-4e3d-4809-875d-aae4e6c4e0ff",E5)

4. Child Activity is to be run multiple times for different inputs, WaitForActivity function is used to get current run waiting for the previous run of StartActivity function.

  1. A dependency is to be created between StartActivity and WaitForActivity and the formulae are filled down using FillDown.sk function. (Left(G6,0) helps in putting a dependency)

  1. The Child Activity 1 will run for Input ‘1’, after 1st run completes, it will run for Input ‘2’ and so on.

  2. For Child Activity 2, multiple runs are not required and hence, WaitForActivity is not used.

NOTE:

  • Output of Start activity is 'Activity Run ID'

  • Activity is identified using 'Unique ID' - Eg "3835920e-4e3d-4809-875d-aae4e6c4e0ff"

  • Child activity start running as soon as it Parent activity starts and it gets correct input

  • ‘Start activity' and 'Wait for activity' not implemented on addin.

  • Output of 'Wait for activity' is activity run status

Development: QueueActivity.SK:

a) Child Activity 3

Inputs:

  • Input entry (any alphabet – It will be derived from the parent activity)

Calculation:

  • For the new entry inserted by parent activity in ‘test_queue’ DB table, child activity updates the details of that specific entry.


b) Parent Queue Activity

Inputs:

  • New Entry: (Any new alphabet entry)

  • Input Date

Steps to Trigger Child Activity 3

  1. Do the operations based on the parent activity inputs and generate inputs for child activity

  2. Setup of StartActivity.SK function:

  3. Sheetkraft TAB -> More TAB -> Web Actions -> Start Activity

QueueActivity Formula:

QueueActivity.SK("test.ChildActivity 3","b6509593-5274-4382-8dad9744c5996a62","success",I5)


1) “test. ChildActivity 3” - Child activity which will be triggered

2) "b6509593-5274-4382-8dad9744c5996a62" - Unique Identifier of the Child Activity 3 which is same in UAT and Prod servers

3) I5 - I5 cell contains the input required for Child Activity3 to run

4) “success” - If parent activity runs successfully, only then Child activity is triggered. Other conditions are: “failure” or ‘always”


3) Parent activity successfully inserts the data into DB for the new entry and provides new entry as input to trigger the Child Activity 3.

NOTE: One can trigger different activities from same parent activity using QueueActivity.sk.