After placing a variable in a format block in a playbook, the variable is expected to replace with a runtime value. To display the value a phantom.debug(VARIABLENAME)can be placed in the custom code section of the format block. However when running the playbook in debug mode only the variable name is returned instead of the runtime value.
The custom code runs and then the format block executes phantom.format(...). This is where the value is looked up and returned. Calling the debug earlier only returns the placeholder value (in this case the variable name).
@phantom.playbook_block()
def format_1(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, loop_state_json=None, **kwargs):
phantom.debug("format_1() called") template = """{0}\n""" # parameter list for template variable replacement
parameters = [
"code_1:custom_function:testoutput"
] ################################################################################
## Custom Code Start
################################################################################ # Write your custom code here...
phantom.debug(parameters)
phantom.debug(parameters[0])
################################################################################
## Custom Code End
################################################################################ phantom.format(container=container, template=template, parameters=parameters, name="format_1") code_3(container=container) return
A phantom.debug will not give the expected results. In order to display the runtime value, create a follow-on custom code block that would accept the input from the format block. There should be two options:
format_1:formatted_data
format_1:formatted_data*
Accepting one of these options and placing that value into phantom.debug(format_1:formatted_data) will output the variable value along with additional data being included in the format block.
| Revision | Publish Date | Comments |
|---|---|---|
1.0 |
30-Sep-2026
|
Initial Release |