RunPollingCommand
Runs a specified polling command one time. This is useful for initiating a local playbook context before running a polling scheduled task. This automation runs using the default Limited User role, unless you explicitly change the permissions. For more information, see the section about permissions here: - For Cortex XSOAR 6 see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations - For Cortex XSOAR 8 Cloud see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script - For Cortex XSOAR 8.7 On-prem see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8.7/Cortex-XSOAR-On-prem-Documentation/Create-a-script
python · Common Scripts
Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 def prepare_arg_dict(ids_arg_name, ids, additional_arg_names, additional_arg_values, using_instance=""): if not isinstance(ids, list): ids = [ids] for i, _val in enumerate(ids): ids[i] = str(ids[i]) args_names = [str(name).strip() for name in argToList(additional_arg_names)] args_values = [str(value).strip() for value in argToList(additional_arg_values)] if len(args_names) != len(args_values): raise ValueError( "arg names and arg values lists does not match, please check your inputs:\n" f"arg names ({len(args_names)}): {args_names}\narg values ({len(args_values)}): {args_values}" ) args = dict(zip(args_names, args_values)) args[ids_arg_name] = ",".join(argToList(ids)) if using_instance: args["using"] = str(using_instance) return args def main(args): # pragma: no cover try: encoded_id = args.get("ids") additional_polling_command_arg_names = args.get("additionalPollingCommandArgNames") additional_polling_command_arg_values = args.get("additionalPollingCommandArgValues") using = args.get("using", "") using_instance = using args = prepare_arg_dict( args.get("pollingCommandArgName"), encoded_id, additional_polling_command_arg_names, additional_polling_command_arg_values, using_instance, ) demisto.results(demisto.executeCommand(demisto.getArg("pollingCommand"), args)) except Exception as exp: return_error(f"An error occurred: {exp}", error=exp) if __name__ in ["__main__", "builtin", "builtins"]: main(demisto.args())
README
Runs a one time specified polling command. This is useful for initiating a local playbook context before running a polling scheduled task.
Script Data
| Name | Description |
|---|---|
| Script Type | python |
| Tags | - |
| Cortex XSOAR Version | 4.0.0+ |
Inputs
| Argument Name | Description |
|---|---|
| ids | The list of IDs to poll. |
| pollingCommand | The name of the polling command to run. |
| pollingCommandArgName | The name of the argument of the polling command. |
| additionalPollingCommandArgNames | The comma-separated arguments of the polling command. |
| additionalPollingCommandArgValues | The comma-separated arguments values of the polling command. |
Outputs
There are no outputs for this script.