How to get the workflow context sys_id in the workflow for run script activity.

nagapramodkanch
Kilo Guru

Hi,

I need to populate the u_context (referenced to wf_context) in the run script activity of the workflow,

but would need a way to get this into the workflow, any inputs?

11 REPLIES 11

benjilali
Giga Contributor

You can get context sys_id using : activity.context

From experimenting with activity.context (inside a workflow activity), it looks like activity.context is a wf_executing GlideRecord for the current activity (activity.getTableName() return 'wf_executing'). Since wf_executing has a reference to the associated wf_context (via wf_executing.context), as benjilali states, you can get the wf_context sys_id for the currently executing activity via activity.context.sys_id. The 'activity' variable is a global to your executing workflow activities, similar to 'workflow' being a global to those same activities.