{"id":835,"date":"2017-09-13T12:47:53","date_gmt":"2017-09-13T12:47:53","guid":{"rendered":"http:\/\/www.toponecrm.com\/blog\/?p=835"},"modified":"2017-09-13T13:12:30","modified_gmt":"2017-09-13T13:12:30","slug":"pre-validation-stage-plugin-example","status":"publish","type":"post","link":"https:\/\/toponecrm.com\/blog\/uncategorized\/pre-validation-stage-plugin-example\/","title":{"rendered":"Pre-Validation stage plugin example"},"content":{"rendered":"<p><span style=\"text-decoration: underline\"><strong>Problem:<\/strong><\/span><\/p>\n<p>You need to do duplicate detection for records created only by users of a particular team. Out of box CRM duplicate detection rule does not allow to filter the records for validation. It is applicable to all records of a particular entity by default. Therefore it requires additional custom logic to be written and of course you dont want any of your: Pre Operation\/ Post Operation\u00a0plugins to be triggered before this validation.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Solution:<\/strong><\/span><\/p>\n<p>Register the plugin on Pre Validation stage. Therefore this validation is the first thing triggered\u00a0when you save the record even before the record is submitted to database for create.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>Note:<\/strong><\/span><\/p>\n<p>Any validation custom logics need to be ideally registered on Pre Validation Stage. <strong>Pre validation plugin runs before any security checks<\/strong>. i.e. even before the CRM check the users security roles to perform the action.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: You need to do duplicate detection for records created only by users of a particular team. Out of box CRM duplicate detection rule does not allow to filter the records for validation. It is applicable to all records of a particular entity by default. Therefore it requires additional custom logic to be written and &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/toponecrm.com\/blog\/uncategorized\/pre-validation-stage-plugin-example\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Pre-Validation stage plugin example&#8221;<\/span><\/a><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":[],"_tribe_ticket_has_attendee_info_fields":false},"categories":[1],"tags":[],"ticketed":false,"_links":{"self":[{"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/posts\/835"}],"collection":[{"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":7,"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"predecessor-version":[{"id":954,"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions\/954"}],"wp:attachment":[{"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/toponecrm.com\/blog\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}