Workflow For loop V/s Destination Rule – Plan per Slot (No Destinations)

[Agenda: To check performance variation between Workflow For loop and Destination RulePlan per Slot (No Destinations) with dynamic slot count.]

Working Example: Let me explain through a scenario where we have list of items which we get from an Smart Object method. Now in workflow we need to loop through each item and perform some task.

Now we have 2 ways to achieve this in workflow.

  1. Using ForEach loop
  2. Using Destination Rule (Plan Per Slot (no Destinations))

Our motive here is to find out which one is faster in execution.

Let’s see the workflow below and go through the each activities.

WKF

010-oneIn this step, “Add to audit” is a SmartObject Event which will insert a record into SQL data base. Here I’m using it to record time stamps to SQL db.
In this particular activity I’m logging this text “For Loop Beginning – {Date Time Stamp}

009-two

In this step, Add For each Event, and click on the icon beside source text box and selected the Smart Object Method that will return us list of Items.

ForLoop

008-threeIn this step, log each item to database. You will need to get the value from Item References under Process/Activity Data tab in Context Browser. See below screen shot.

LogForItem

007-four

 

In this step, Log this text “For Loop End & Dynamic Start – {Date Time Stamp}

 

 006-fiveIn this step, Add an activity and select destination rule Plan per slot (no Destinations).

(***If you are unable to see this option then just click back button and check advanced option and click next)

Click next button, now you need to select second radio option which says “select a list field to determine how many slots should be created.”

Select the Smart Object method which gives you the list of items and finish.

Now you can access those items in Instance Data Field under tab Activity Destination Instance in Workflow Context Browser.

See below screens PlanPerSlotLogDynamicItem

005-six

 

In this step, log text “Dynamic End – {Date Time Stamp}

 

Now just deploy the workflow and start a process instance and check the data base results. 

Results

SQLResults

Results

Result: For loop took 5 seconds to log 10 items to data base whereas Destination Rule took just 1 second to log 10 items.

So conclusion here is Destination Rule method is much faster than for loop.

Advertisements

Author: Vijay

I'm a K2 Certified Developer, helping teams to automate, design, develop & maintain business process applications connecting across multiple platforms with multiple technologies.

One thought on “Workflow For loop V/s Destination Rule – Plan per Slot (No Destinations)”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s