# Can I Make a Validation Rule with Code?

**URL:** <https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124>\
**Category:** CMS Development\
**Tags:** local-development\
**Created:** [April 25, 2019, 7:27pm UTC](https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124 "2019-04-25T19:27:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MitchA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mitcha/32/102945_2.png) [@MitchA](https://community.hubspot.com/u/MitchA)\
**Post date:** [April 25, 2019, 7:27pm UTC](https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124/1 "2019-04-25T19:27:25Z")

</div>

My client needs to force users to fill out certain fields before they are able to move deals to Closed Won.

I know we cannot do this out of the box.

Can we do it with code?

---

<div class="post-metadata">

**Author:** ![lscanlan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lscanlan/32/66262_2.png) [@lscanlan](https://community.hubspot.com/u/lscanlan)\
**Post date:** [April 30, 2019, 3:22pm UTC](https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124/2 "2019-04-30T15:22:09Z")

</div>

Hi @MitchA,

Have you considered building something through our Deals API? You can find the documentation for updating deals here: [https://developers.hubspot.com/docs/methods/deals/update\_deal](https://developers.hubspot.com/docs/methods/deals/update_deal). You could potentially have some validation externally for this, and then push the deal stage update through the API. You’d want to update the “dealstage” property for it.

Let me know if you have questions about that.

- Leland

---

<div class="post-metadata">

**Author:** ![MitchA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mitcha/32/102945_2.png) [@MitchA](https://community.hubspot.com/u/MitchA)\
**Post date:** [April 30, 2019, 3:28pm UTC](https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124/3 "2019-04-30T15:28:19Z")

</div>

Hello Leland, thanks for this… whom can I hire to do this? Where do I find Hubspot Developers who can help with this kind of work?

Also, what external system would you suggest for this kind of scenario?

Salesperson wins the deal. The salesperson goes to move the deal to Closed Won, BUT that salesperson has fields that are not populated but are critical for record-keeping.  
What kind of external sales process are you suggesting that would help solve this?

When do we think validation rules are coming natively to Hubspot?

---

<div class="post-metadata">

**Author:** ![MFrankJohnson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mfrankjohnson/32/22490_2.png) [@MFrankJohnson](https://community.hubspot.com/u/MFrankJohnson)\
**Post date:** [April 30, 2019, 4:02pm UTC](https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124/4 "2019-04-30T16:02:33Z")

</div>

\*\*  
 ![_hubspot-button-accept-as-solution-gif-v00.gif](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/8/280f73986e0517a27aa4068d06718dbcda1a42a2.gif)  
\*\*

**Q** : My client needs to force users to fill out certain fields before they are able to move deals to Closed Won. ?

**Short A** : n/a

**Longer A** :

Code? Is there some reason we’re not just doing this with native HubSpot built-in functionality? (no code required)

- see [this thread](https://community.hubspot.com/t5/CRM/Mandatory-properties-on-Deals-get-skipped-when-creating-a-deal/m-p/252111#M112272)

- see [Set up and customize your deal pipelines and deal stages](https://knowledge.hubspot.com/articles/kcs_article/deals/set-up-and-customize-your-deal-pipelines-and-deal-stages)

Help answer your question? If so, remember to accept this solution now.

Best,  
Frank

Chief HubSpot Consultant

* * *

* * *

 ![hubspot-solutions-signature-mfrankjohnson-v05.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/7/27f33a2557b556a36da15be33d54ef60513d59ef.png)

* * *

[MFrankJohnson.com](https://www.mfrankjohnson.com/?utm_source=hs-forum) | [_Perfect HubSpot_ Series](https://mfrankjohnson.com/blogs/marketing-lab/tagged/_featured/?utm_source=hs-forum) | [Connect on LinkedIn](https://www.LinkedIn.com/in/mfjlabs)

 

_ **Help find posts quickly … accept this solution now.** _

---

<div class="post-metadata">

**Author:** ![MitchA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mitcha/32/102945_2.png) [@MitchA](https://community.hubspot.com/u/MitchA)\
**Post date:** [April 30, 2019, 4:23pm UTC](https://community.hubspot.com/t/can-i-make-a-validation-rule-with-code/14124/5 "2019-04-30T16:23:00Z")

</div>

THANKS FRANK!!! Yes that is what I’m looking for.

Best,

Mitch
