Is there a way to ensure I'm not setting a deal stage to a prior state?


I'm updating the deal_stage property of a deal using the api documented here:

Imagine a pipeline that consists of three stages:

first ---> second ---> third

Now imagine i have a deal d, currently at second in the pipeline.

Is there a way to ensure that trying to set deal_stage of d to first using:

     "properties": [
      "name": "dealstage",
      "value": "first"

will _fail_ based on the fact that I'm trying to move it backwards in the pipeline?


Hi @kwonderschool, welcome! Are you using this endpoint: instead of the one you listed above? The endpoint you listed simply updates a particular property on a deal. For example, If I wanted to change a property on deal from a dropdown to an input, I'd use the one you specified, but use the one I specified when making changes to an actual deal in your Account.

That said, for your actual question, there isn't a way to do that out of the box. You can set deals back a stage in the UI, and we don't have a method for preventing this behavior in the API. What you could potentially do is code this behavior in to your application if you're developing one. To do this, you could make a GET to the pipelines API, then assign a sequential number value to each stage. If the number of the stage you're updating to is greater than the number of the stage that the deal is currently on, you can go ahead and make the request. If it is the opposite, then you could prevent your code from running.

Hope that helps clarify a little!


Thanks, somehow I got the wrong link in there, I've updated it now.

Thanks for suggesting the sequence number route. I do have an app planned so that's a viable solution for me.