Splunk SOAR

Is there documentation on Code Block Self.Name type of param?

nongingerale
Explorer

Probably a silly question but for the life of me can't find documentation - when we create a code block, how do we call the the name of said code block? Currently want to add extra information in my error handling and want to include the name of the code block that it occurs under.

I tried variations of phantom.name, custom_function__name, custom_function.name/(), self.name, etc. Any help is appreciated!

Labels (2)
0 Karma

phanTom
SplunkTrust
SplunkTrust

Not sure about this one but would need to know more about how you are error handling at the moment?

The only way I can see is to have2 ouputs with an output containing the name of the code block hardcoded and if you are outputting a pass/fail you can also pass out the block name and then stitch together in your error handling?

0 Karma

nongingerale
Explorer

I'd want to make things are generalized as possible and avoid hard-coding anything (for scalability and good coding practice reasons), so if I were to (for example) have a separate function that takes in a variable for the name and the "error message" to include that in part of error handling,

or similarly, if i were to incorporate simple try/except portions in my code where i want to include the name of the function (without hard coding the name)

is that possible? currently I have things hard coded and the pass/fail option doesnt meet this need. If its not implemented then its definitely something that would be useful in later iterations of Phantom since itll help debugging (hardcoding the name at the moment is ok but not scalable)

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...