# Passing data from workflow to activity inside context

**URL:** <https://community.temporal.io/t/passing-data-from-workflow-to-activity-inside-context/10320>\
**Category:** Community Support\
**Tags:** go-sdk, general-impl, activity\
**Created:** [December 7, 2023, 9:13pm UTC](https://community.temporal.io/t/passing-data-from-workflow-to-activity-inside-context/10320 "2023-12-07T21:13:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/bryan/32/3245_2.png) [@Bryan](https://community.temporal.io/u/Bryan)\
**Post date:** [December 7, 2023, 9:13pm UTC](https://community.temporal.io/t/passing-data-from-workflow-to-activity-inside-context/10320/1 "2023-12-07T21:13:08Z")

</div>

As far as I know, if I want to pass some data from workflow class to an activity class, I can use context and context propagator. In Go-samples code, so far I can only find activities that use the ctx object for logging:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/temporal/original/2X/8/89e76ad881817cc6ecc9c3952ee9fa51a487a979.png)

Without using context propagator, what are the other uses of ctx inside activity?

When executing activity, we can pass multiple arguments. Currently, I create a map to pass additional variables to activity.

> ExecuteActivity(ctx Context, activity interface{}, args …interface{})

If I pass the workflow context as the last argument, can I access the value from inside activity without context propagation?

From this article, [Passing Context with Temporal​ | Spiral Scout Company News](https://spiralscout.com/blog/passing-context-with-temporal#why-do-we-need-context), it is suggested that I should not pass business data (e.g. userId) using context to activity. I don’t quite understand about this:

> “the services don’t work with the context, and it is not best practice to extract some context values from the service directly. Please note, we can encapsulate it in a ContextRegistrar component under interface.”

Service refers to the activity right? We should use ContextRegistrar to access the context, but can the ContextRegistrar return the ctx value back to activity? Because I want to use it inside the activity. The addition of ContextRegistrar adds complexity to the activity implementation, is there a better and simpler way?

---

<div class="post-metadata">

**Author:** ![WvdL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/wvdl/32/4660_2.png) [@WvdL](https://community.temporal.io/u/WvdL)\
**Post date:** [December 8, 2023, 9:43am UTC](https://community.temporal.io/t/passing-data-from-workflow-to-activity-inside-context/10320/2 "2023-12-08T09:43:43Z")

</div>

I guess its mostly about a ‘clean’ activity for idempotency.  
Using/manipulating on a (workflow) context means you might break that rule so might get weird behavior on retries
