What is the best way to use the Hubspot trigger "New Deal In Stage" to only run when a new deal enters a specified deal stage?

This topic was automatically generated from Slack. You can find the original thread here.

Hello! I am using the hubspot trigger “New Deal In Stage” (pipedream/new-deal-in-stage.mjs at master · PipedreamHQ/pipedream · GitHub ). The workflow should only run when a new deal enters a specified deal stage. However, I have noticed that the workflow runs each time a deal in this stage is modified. So it’s not only triggered when a new deal enters the deal stage, but also when a deal in this deal stage is modified. Any suggestions? I know that hubspot deals have a property that contains the datetime when a certain deal stage is entered.

Hello , I’m not able to reproduce you issue.

I created a Pipedream Hubspot - New Deal In Stage source, and then is I added 5 deals into the desired Stage (Qualified To Buy). Running the source, I see 5 events emitted (1st and 2nd images below)

Then I updated the name of 2 deals on Hubspot and run the source again, I see no new event emitted (3rd and 4th images below)

Finally, I updated 5 more deals into the Qualified To Buy stage, and I see 5 more events emitted (5th and 6th images below)

Could you share your steps to reproduce your issue?

Hi , thanks for looking into it. These are the steps to reproduce:

  1. create a deal in hubspot and set it to the target deal stage (written acceptance in my case). In my case the deal was created 2 years ago and moved to written acceptance on 24 March 2021
  2. create a Pipedream Hubspot - New Deal In Stage source (no events are emitted at this point yet because it’s an old deal)
  3. do some activity in the deal (in my example I logged an email )
  4. event is emitted for this old deal

Hi , thank you for your information.

I have just tested your steps to reproduce to update the existing deals in the desired stage to see if there’s any event, the result is no event emitted for those existing deal for my case (I updated the name, Deal Owner, Deal Type and Priority)

May I ask how do you updating the Deal? Is it from the UI? Or from anywhere else?

Some deals were just updated via the UI (for the example I showed you I used the UI to log an email). Other deals are updated automatically via our google mail integration (for example when an email is send)

Could you try if updating via the UI will emit an event on Pipedream?

I suspect that the issue only happen when Google mail integration update the deal

I just updated an old deal via the UI (I changed the name in hubspot) and this emitted a new event

image.png

This deal was already in the dealstage ‘written acceptance’ since 28 jan 2021

I see. May I ask when did you created this source? Is it possible for you to re-create a new source and try again?

I have a new theory that you may have been using an old version of the source

I have created this source the day before yesterday (7th of february 2023). I will create a new source and try it again to see if I can reproduce it.

Thank you so much! I will try to reproduce this issue again on my side

I created a new source, went to hubspot and looked for an old deal in the dealstage written acceptace, changed the name of this deal and a new event was emitted. If I do new modifications to this deal (I changed the name again) no new event is emitted. So it seems to happen only the first time an old deal is modified.

I’ve tried but I couldn’t reproduce this behavior. I will ping Pipedream component dev who familiar with the source for advice!


Hello , as you worked on this Hubspot source previously, could you advice what is the cause for this behavior?

@U03CXTHK4RF I was able to reproduce the issue, and I’ve created a PR (Hubspot - Bug fix to New Deal In Stage by michelle0927 · Pull Request #5447 · PipedreamHQ/pipedream · GitHub) to fix it! The source will now check the date that the deal was moved into its stage instead of the date the deal was last updated.

great! Thank you for the fast response!