Running Automation Scripts directly from a Button


#1

Running Automation Scripts from a Button chapter describes a way to run our own scripts from a custom button. Footnote #1 explains that we can skip creating a Request entry point by requesting Call_Instance directly with the appropriate attributes (similarly to the Simulation form): namespace, class, instance

This process still requires an instance defined for the method. Here is a way to call methods directly:

Copy /System/Process/Request instance to your own domain and rename it Call_Method. Add a new field to the schema of /System/Process with State type. Now modify /System/Process/Call_Method to call the method directly (and remove all other values copied from Request instance):

dotmethod

Now set the advanced options of the button. (The request option is not used, but required.)

For the path of the method the “dot notation” must be used.
Logs:

Q-task_id([resource_action_161]) User [customer1] with current group ID [20] name [EvmGroup-customer1]
Q-task_id([resource_action_161]) Instantiating [/SYSTEM/PROCESS/Call_Method?MiqServer%3A%3Amiq_server=1&Service%3A%3Aservice=69&User%3A%3Auser=2&dialog_volname=volu3&dialog_volume_id=72&dotmethodpath=%2FService%2FGeneric%2FStateMachines%2FMethods.mount&object_name=Call_Method&request=zzz&vmdb_object_type=service]
Q-task_id([resource_action_161]) Updated namespace [/SYSTEM/PROCESS/Call_Method?MiqServer%3A%3Amiq_server=1&Service%3A%3Aservice=69&User%3A%3Auser=2&dialog_volname=volu3&dialog_volume_id=72&dotmethodpath=%2FService%2FGeneric%2FStateMachines%2FMethods.mount&object_name=Call_Method&request=zzz&vmdb_object_type=service  HPC/SYSTEM]
Q-task_id([resource_action_161]) Processing State=[state1]
Q-task_id([resource_action_161]) Updated namespace [service/generic/statemachines/methods/mount  HPC/service/generic/statemachines]
Q-task_id([resource_action_161]) Invoking [inline] method [/HPC/Service/Generic/StateMachines/Methods/mount] with inputs [{}]
Q-task_id([resource_action_161]) <AEMethod [/HPC/Service/Generic/StateMachines/Methods/mount]> Starting
Q-task_id([resource_action_161]) <AEMethod mount> MOUNT starting...
Q-task_id([resource_action_161]) <AEMethod mount> MOUNT ended...
Q-task_id([resource_action_161]) <AEMethod [/HPC/Service/Generic/StateMachines/Methods/mount]> Ending
Q-task_id([resource_action_161]) Method exited with rc=MIQ_OK
Q-task_id([resource_action_161]) Processed State=[state1] with Result=[ok]
Q-task_id([resource_action_161]) Processed State=[state1]
Q-task_id([resource_action_161]) Next State=[]

Hope that helps.