Automic Workload Automation

Expand all | Collapse all

How to pass a variable set in a script to a JOBP.IF?

  • 1.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 10, 2014 01:11 PM
    Hello friends,

    So I have been tasked with automating the restart of out AM V8 agents using AE V10. I was asked to use one job/workflow to restart either a Windows agent or a UNIX agent. This is what I have been trying to make work so far...I am trying to pass a value that I am setting in a script object to a JOBP IF object and am not having any success. 

    I have a JOBP standard at the highest level, which has some prompts on it and is where I get the &APPWORX_AGENT# value.

    The first thing the workflow does is call a script object which does a PSET &AGENT_OS# = GET_VAR(VARA.APPWORX_AGENTS,&APPWORX_AGENT#,2), which grabs the value in the second column of this vara (This works as evidenced in the report).

    I then call a JOBP IF to check the value of that variable but it keeps telling me that the variable does not exist yet("Syntax error in object 'JOBP.IF.RESTART_APPWORX_AGENT', line '00000'. 'U1001308 Variable 'AGENT_OS#' has not yet been defined.'."). 

    I have tried to PUBLISH the &AGENT_OS# to the "TOP" level and that does not work either.

    What am I doing wrong? Is there a better way? Should I be using ARA instead?

    Thank you in advance for any help, suggestions and time.

    -Steve T.


  • 2.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 10, 2014 02:00 PM
    I just tried removing the JOBP IF and replacing it with the actual JOBSes that I want to run instead. I used the preconditions tab on each of them to test the value of the variable and then run the job if it is a certain value or else skip. It still has the same issue:
     
    "The Workflow 'JOBP.APPWORX_AGENT_RESTART.MAIN_WORKFLOW (0001156590)' has been canceled by user 'D40195152/DVUTEST'."




  • 3.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 10, 2014 02:58 PM
    Try adding PASS_VALUES when you execute the JOBP IF in the script.

    Example: :set &act_OBJ#=ACTIVATE_UC_OBJECT("&JOB_NAME#",,,,, PASS_VALUES)


  • 4.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 10, 2014 03:40 PM
    Adding that into the script set off an infinite loop of jobs. I had to delete the line from the script while it was active in order to get it to stop spawning more jobs. I would really prefer to only use the script to set variables and not to call other jobs if possible. I thought that by passing the variable to the top level and or pset-ing it is supposed to pass it to all of the other objects within the parent container.


  • 5.  How to pass a variable set in a script to a JOBP.IF?
    Best Answer

    Posted Dec 10, 2014 04:19 PM
    Hmmm, that should work, I set Script Variables in a Script Object to prep some of my jobs in a Workflow.

    Do you have "Generate at Runtime" checked for the IF Workflow?


  • 6.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 10, 2014 05:08 PM
    (sigh).... I thought I did have it on. Thanks JG! You're the best! You always have the answer =) 

    How do I turn it on automatically for all new objects?

    Thanks.


  • 7.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 10, 2014 09:05 PM
    The 'Generate at Runtime' checkbox always gets me too when I'm building new things. ;-) 

    Check out the comment I made in this post, if you check the 'Generate at Runtime' box in the Template object, all new objects created of that type will have the box checked. 


  • 8.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 11, 2014 10:45 AM
    Not for the first time and definitely not for the last time, Thank you Jen the Genius! =D

    Is there a scenario where I would not want 'Generate at Runtime' checked? It seems to be my number one "gotcha".

    If I do not change the template, are there specific error messages that should trigger the "Is generate at runtime checked?" response? You know, just in case the Bawsman doesn't want the template changed.


  • 9.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 11, 2014 11:46 AM
      |   view attached
    The 'Working' Date is one major reason why some Objects wouldn't want the 'Generate at Runtime' set. 
    Especially for the Finance sector when the workflows might run into the next day. 

    You could do 2 different types of Templates for a type of object.

    I've attached an export you can load straight into a Test Client to look at.
    ** Make sure not to load it into Client 0 or all your Clients will use the custom UC_OBJECT_TEMPLATE. I've modified it to remove objects I don't use in my system. (I don't like too much clutter...)

    gbulas5owt5o.pnghttps://us.v-cdn.net/5019921/uploads/editor/7r/gbulas5owt5o.png" width="1467">


    I think you're using 10, if not, edit the 2nd line in the file and replace the version with the build of your UI.
    <uc-export clientvers="10.0.3+build.663">

    I should write up a post with more details on customizing Template Objects... Once I figure out the Chatter REST API for your boss, I'll get to it. ;-)

    Attachment(s)



  • 10.  How to pass a variable set in a script to a JOBP.IF?

    Posted Dec 11, 2014 01:54 PM
    Haha sounds good. We are using 10.0.3. I will get a client set up and play around with this example.

    Thank you JG. =)