{"id":1273,"date":"2022-02-13T02:01:40","date_gmt":"2022-02-13T02:01:40","guid":{"rendered":"https:\/\/morecpq.com\/?p=1273"},"modified":"2022-02-13T02:06:12","modified_gmt":"2022-02-13T02:06:12","slug":"validation-rules","status":"publish","type":"post","link":"https:\/\/morecpq.com\/index.php\/2022\/02\/13\/validation-rules\/","title":{"rendered":"Validation Rules!"},"content":{"rendered":"\n<p>So you need to configure a validation rule, eh?  And you\u2019re not sure where to start!  You\u2019ve come to the right place!  Tho this place is about CPQ, we are still big fans of the platform as a whole!<\/p>\n\n\n\n<p>So let\u2019s create a requirement that would need a validation rule.  Let\u2019s make it simple!<\/p>\n\n\n\n<p><strong>Requirement<\/strong><\/p>\n\n\n\n<p>As the manager of an account rep, I need to make sure the account reps are entering descriptions for certain accounts.<\/p>\n\n\n\n<p><strong>Design<\/strong><\/p>\n\n\n\n<p>Two new fields on the Account object: Checkbox &gt; Needs Description and Text &gt; Description.  <\/p>\n\n\n\n<p>Validation: On an Account record, if the Needs_Description__c checkbox is checked, then the Description__c field must have a value.<\/p>\n\n\n\n<p>Pretty simple.  Create the fields.  Great.  Make sure only the Manager profile can see the Needs_Description__c field!  Page Layouts should do the trick.<\/p>\n\n\n\n<p>The first step for the validation rule is to put it into validation rule language:  On an Account record, if the Needs_Description__c checkbox is checked and the Description__c field is blank, show a validation error message near the Description__c field that says \u201cYou must have a Description for this Account.\u201d <\/p>\n\n\n\n<p>This validation rule language is super important because it tells you how to configure the validation rule.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Go to Setup &gt; Object Manager &gt; Account &gt; Validation Rules<\/li><li>Click New<\/li><li>Name: Needs Desc = Required: Desc<\/li><li>Formula: AND(Needs_Description__c = True, ISBLANK(Description__c))<\/li><li>Error Message: You must have a Description for this Account.<\/li><li>Display: Near field: Description__c<\/li><li>Active: Checked<\/li><\/ul>\n\n\n\n<p>The formula is the tricky part.  The formula is written based on the \u201cif\u201d part of the validation language: if the Needs_Description__c checkbox is checked (Needs_Description__c = True) and (AND) the Description__c field is blank (ISBLANK(Description__c)).<\/p>\n\n\n\n<p>Tell us all about your validation rule woes in the comments!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you need to configure a validation rule, eh? And you\u2019re not sure where to start! You\u2019ve come to the right place! Tho this place is about CPQ, we are still big fans of the platform as a whole! So let\u2019s create a requirement that would need a validation rule. Let\u2019s make it simple! Requirement &hellip;<br \/><a href=\"https:\/\/morecpq.com\/index.php\/2022\/02\/13\/validation-rules\/\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Validation Rules!<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1273","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/1273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/comments?post=1273"}],"version-history":[{"count":4,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/1273\/revisions"}],"predecessor-version":[{"id":1277,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/1273\/revisions\/1277"}],"wp:attachment":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/media?parent=1273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/categories?post=1273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/tags?post=1273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}