03-19-2013 05:34 PM - edited 03-01-2019 08:59 AM
I have a job group that has 3 jobs : Job 1-> Job 2-> Job 3
I would like to use a local variable to store the output from Job1 and use it while calling Job 3. We needed the variables to be specific to each run.
I tried the following, but was unsuccessful
1. I define the variable localFeedID in the Job Group
2. Then I go into Job 1. Under Job events, I try to insert an action to store the output of Job 1 into localFeedID. The local variable is not visible.(I later heard from Cisco this is expected behaviour)
What is the right way to achieve this ?
- Dinesh
Solved! Go to Solution.
03-20-2013 07:23 AM
You can't use local variables in actions because actions exist outside of the group. I initially forgot about that restriction.
There is a way to accomplish this. On the Dependency tab of job 3 add a dependency on job 1. This establishes a relationship between the jobs and allow you to reference the job variable from job 1 in job 3. Click on the Variables button. Select Job Variables, "Job 1" (from the list), Job Output. This will insert a variable named
Tracy
03-20-2013 07:23 AM
You can't use local variables in actions because actions exist outside of the group. I initially forgot about that restriction.
There is a way to accomplish this. On the Dependency tab of job 3 add a dependency on job 1. This establishes a relationship between the jobs and allow you to reference the job variable from job 1 in job 3. Click on the Variables button. Select Job Variables, "Job 1" (from the list), Job Output. This will insert a variable named
Tracy
03-20-2013 12:57 PM
Hi Tracy
Thank you. I got it working using your approach. Just one minor correction - the Job Output variable is under Job Run Variables
-Dinesh
03-27-2013 01:05 PM
Would like to add that using this approach will decrease readability. So if you are a production support personnell, and you have many variables in the job, you will have a hard time understanding what each
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide