Hello Team,
I am new to HubSpots and I am working on custom workflow. I have 2 confusions while coding:
1.How can I transform data between differnet actions?
The workflow I am building look like this:
In the first action, I get and return phone number of all the enrolled contacts. The first action should be fine since it has passed the test.
Here’s my code:
import os
import hubspot as HubSpot
from hubspot.crm.contacts import ApiException, SimplePublicObjectInput
def main(event):
hubspot = HubSpot.Client.create(api_key="my api key")
phone = ''
try:
ApiResponse = hubspot.crm.contacts.basic_api.get_by_id(event.get('object').get('objectId'), properties=["phone","hs_object_id"])
contact_id = ApiResponse.properties.get('hs_object_id')
phone = ApiResponse.properties.get('phone')
except ApiException as e:
print(e)
raise
return {
"outputFields": {
"contact_id": contact_id,
"phone": phone
}
}
The data outputs is set like this:
Then I want to transform the returned value to next action. I am not sure how to do that. I tried to follow the guide but still failed. Here’s my code of the second Action and test result:
import os
from hubspot import HubSpot
from hubspot.crm.contacts import ApiException, SimplePublicObjectInput
def main(event):
phone = event.get('inputFields').get('phone')
return {
"outputFields": {
"phone": phone
}
}
And the result looks like this:
How should I transform the value between Actions?
And in the next step I will try to transform the data between workflow. Can they work in the similar logic?
Thanks for the help!



