Accessing Task Context Variables

Hello,

I’m working on scripts within Morpheus and am looking to retrieve more context information about the task that’s currently being executed. I know it’s possible to access variables like the ID, name, owner, and more of the instance in whose context the task runs (as per the Variables Examples https://docs.morpheusdata.com/en/latest/troubleshooting/Variables_Examples.html).

However, I’d like to retrieve details about the task itself within a script, specifically:

  • The name and ID of the task that’s currently executing
  • The phase in which it’s being executed (e.g., post provisioning, reconfigure, etc.)
  • The user who initiated the execution

These pieces of information are available in the UI and can be seen in the instance’s history, but I haven’t found a goos way to access them programmatically within a script. Without this, I’m unsure which task the current script is executing in.

Is there a way to access these task context variables within a script? Any guidance or suggestions would be greatly appreciated.

Thank you!

I believe user.X will get you the data you need for whomever initiated.

id,accountId,username,displayName,firstName,lastName,email,linuxUsername,windowsUsername

I think there’s a task name/id var too, but trying to confirm.