The CreatorCon Call for Content is officially open! Get started here.

Success or failure condition for custom activity

amaradiswamy
Kilo Sage

Hi All,

I want to learn orchestration custom powershell activities, so i created a custom activity to just ping one server if we get response then it should go to next acitivity otherwise workflow should end.

Workflow command:

$script:checkHostReachability_Output=Invoke-Command -ScriptBlock {

Test-Connection -ComputerName test -Quiet

}

echo "StandardOperator_Output=$checkHostReachability_Output"

$script:checkHostReachability_Return=if($script:checkHostReachability_Output -eq $true) {0} else {1}

echo "checkHostReachability_Return=$checkHostReachability_Return"

In the out put i defined

find_real_file.png

In conditions, i used below

find_real_file.png

success: activityOutput.checkHostReachability_Return == 0

failure: activityOutput.checkHostReachability_Return == 1

But evn though it is giving correct repsonse, tyhe transition is not going to next task. Did i miss anything to include here?

Thanks and regards,

Swamy

2 REPLIES 2

Jason Stephens
Kilo Guru

Hi Swamy,



Did you get this figured out?   I'm having a similar issue in that I am trying to use the activity.result in my condition, and it will not set correctly.   Just wondering if you have any insight into fixes.   Thanks!



Jason


Community Alums
Not applicable

Swamy,



A couple quick thoughts:


  • Try putting the numbers in quotes in your conditions. For example, activityOutput.checkHostReachability_Return == '0'
  • How are you setting these output values in the Parsing rules? I see it is direct, but this next step should help you validate that it is set the way you expect.
  • Validate that your activity outputs are correct. In the post processing, you can write to the system log. Something like this: gs.log("checkHostReachability is: " + activityOutput.checkHostReachability_Return,"CUSTOMACTIVITY"); // You can search on CUSTOMACTIVITY or whatever you use in these quotes in the Source column to easily find your log info.

Ben