Topic
  • 4 replies
  • Latest Post - ‏2013-03-22T17:16:32Z by SystemAdmin
SystemAdmin
SystemAdmin
5842 Posts

Pinned topic Child script

‏2013-03-20T20:52:59Z |
Has anyone had any experience invoking a child script in Automation Scripting?

Here's my test case (7.5.0.3):

Parent script passes a string variable representing a series of security groups "'AP-Manager','VP_ACCT','BUYER'" to the child script which returns a boolean value back to the parent based the logged in user's membership in of one of the groups.

I can do the logic in the child script, I just can't figure out a way to invoke it from other scripts that need to do this validation. I've attached the logic as a txt file (It works).

If anyone can help, thanks. If not, thanks anyway.

Brian Baird
Updated on 2013-03-22T17:16:32Z at 2013-03-22T17:16:32Z by SystemAdmin
  • SASHULL
    SASHULL
    280 Posts

    Re: Child script

    ‏2013-03-22T02:35:05Z  
    Based on the requirements, I don't know of a solution but know that it would be of huge value to enable that level of functionality (like a subprocess in a workflow). We've thought about how we could create custom Jython libraries to do some data validation that we could import at script runtime but it wouldn't be able to take advantage of the Maximo framework like your script needs (it'd be more for validating data such as values are in proper phone format, IP Address format, etc.).

    I'm going to spend some time testing this scenario out but it may need to be an RFE. I'd be curious if anyone else has ideas.
  • SystemAdmin
    SystemAdmin
    5842 Posts

    Re: Child script

    ‏2013-03-22T12:06:37Z  
    • SASHULL
    • ‏2013-03-22T02:35:05Z
    Based on the requirements, I don't know of a solution but know that it would be of huge value to enable that level of functionality (like a subprocess in a workflow). We've thought about how we could create custom Jython libraries to do some data validation that we could import at script runtime but it wouldn't be able to take advantage of the Maximo framework like your script needs (it'd be more for validating data such as values are in proper phone format, IP Address format, etc.).

    I'm going to spend some time testing this scenario out but it may need to be an RFE. I'd be curious if anyone else has ideas.
    Thanks Steven, I was getting to the same place pulling out my hair. I may end up working toward a class that would be able to behave like its own launch point for other scripts. I'll let you know where I end up.

    Thanks, Brian
  • JC_Wilson
    JC_Wilson
    4 Posts

    Re: Child script

    ‏2013-03-22T15:03:53Z  
    Hi Brian,

    Check out the jython examples for TSRM here. There is a script called ScriptExecutesScript found here. It's an older style script so you will need to make adjustments to it like replacing scriptHome with mbo. If you read it, you can plainly see that all you are doing in bringing in the code of the child script and executing it within the parent script. So, any variables available in your parent script will be available in your child script.
    Good Luck and please post your progress and code (if you are allowed to).
    John
  • SystemAdmin
    SystemAdmin
    5842 Posts

    Re: Child script

    ‏2013-03-22T17:16:32Z  
    • JC_Wilson
    • ‏2013-03-22T15:03:53Z
    Hi Brian,

    Check out the jython examples for TSRM here. There is a script called ScriptExecutesScript found here. It's an older style script so you will need to make adjustments to it like replacing scriptHome with mbo. If you read it, you can plainly see that all you are doing in bringing in the code of the child script and executing it within the parent script. So, any variables available in your parent script will be available in your child script.
    Good Luck and please post your progress and code (if you are allowed to).
    John
    AHA, scriptHome = mbo, no wonder I couldn't get it to play nicely. Let me give that a try. Thanks