I’ve sucessfully written code to pull the userid of the person who made the change to the property that triggers my workflow, but now I’m struggling to get that userid to be set as the lead owner.
I’m currently setting the UserId output as a ‘number’. When I try to use action output in an edit record action (to fill the lead owner) the option is greyed out and says that the action output is not compatible. I tried outputting as a string as well.
Is there a way to translate a custom coded action output to a userID? Or, is there a way to use the last CCA’s output as an input in another custom coded action, so I can write some code to update the lead owner?
Thanks y’all.
Hey, @JLittle2
Can you share your code? Along with screenshots of how the action is set up? It’s hard to say anything for sure without testing a bit.
Thanks! — Jaycee
Turns out there are two different user identifiers in hubspot - UserID and hubspot_owner_id. Since property change history records UserID, not the owner id, I had to use the userID to find owner id.
I first tried using a search post request (Accounts Dashboard | HubSpot) but apparently it isn’t available with the owners object. So intstead I had to create code that pulls all the owners, searches for the correct userID, and finds the hubspot_owner_id of that userID - then updates the lead owner using the hubspot_owner_id.
here’s my first set of code for pulling the userID of the property change instigator (the property create_lead is how my workflow is triggered, so I didn’t need to check for a specific value that it was changed to):
Retrieve Property Change Instigator userID
Here’s my code to search owners to find the correct userID, and set the lead owner:
pull hubspot_owner_id using userID, update lead owner
Hopefully this helps someone(: