# ask-the-community

Jay Ganbat

04/03/2023, 11:17 PM
Hi all, so i have a task that returns a Dataclass and i want to refer to the field of that object in the workflow is it possible? for ex:
Copy code
class MyDataClass:
   name: str

def my_task() -> MyDataClass:
   return MyDataclass object

def another_task(name: str) -> str:
   return f"Hello {name}"

def my_wf() -> None:
   result = my_task()
when i try the above, it says
'Promise' object has no attribute 'name'
i just didnt wanna give the whole object to the task, i just want 1 field from it 😅

Kevin Su

04/03/2023, 11:23 PM
unfortunately, you can’t get the name from promise. you could use dynamic workflow to workaround it. like @dynamic def d1(res: MyDataClass) -> None: another_task(

Jay Ganbat

04/03/2023, 11:42 PM
i see, do you think it would change in the future so that Promise knows the attrib of the underlying outputs and inputs

Dan Rammer (hamersaw)

04/04/2023, 1:13 PM
@Jay Ganbat we have had some small discussion surrounding this. The use-case can be either using individual fields of a dataclass or indexing into a list. The issue with dataclass support is that currently flytekit handles serialization / deserialization of data and the backend (ie. flytepropeller) is completely unaware of format. To add support for using individual fields we would need to add additional context to the data type. It is certainly something we can do in the future, but currently not very high priority.

Jay Ganbat

04/04/2023, 4:17 PM
gotcha, thank you for the detailed explanation 😄