{"id":907,"date":"2022-01-19T15:51:22","date_gmt":"2022-01-19T15:51:22","guid":{"rendered":"https:\/\/logicbuilder.integroscrm.com\/help\/?page_id=907"},"modified":"2022-08-03T17:23:29","modified_gmt":"2022-08-03T17:23:29","slug":"find-or-create-entity","status":"publish","type":"page","link":"https:\/\/logicbuilder.integroscrm.com\/help\/find-or-create-entity\/","title":{"rendered":"Find Or Create Entity"},"content":{"rendered":"\n<p><a name=\"abstract\"><\/a>Returns record that was found by input filters or creates a new one if there is no record by the provided filters.<\/p>\n\n\n\n<p>It works similar to <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/retrieve-entities-by-attributes\/\">Retrieve Entities By Attributes<\/a>: <span style=\"font-size:14px;\">provide filters<\/span> to find records. However it may return only one record that satisfies search criteria, so keep in mind that if there are several entities that meet the criteria, only one will be returned anyway.<\/p>\n\n\n\n<p>If there is no record that satisfies the criteria, the new one is created. In order to have created record as a result always use <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/set-entity-attributes\/\">Set Entity Attributes<\/a> and <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/save-entity\/\">Save Entity<\/a>.<\/p>\n\n\n\n<p>Note that <span style=\"color:#ec8f45;\">Find or Create Entity<\/span> doesn&#8217;t set values to fields that were provided as input criteria during record creation.<\/p>\n\n\n\n<p><strong>inputs:<\/strong><\/p>\n\n\n\n<p><span style=\"color:#9ed267;\">module<\/span> &#8211; select directly in the operator module from the module list which record is needed to find or create.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Required: yes<\/li><\/ul>\n\n\n\n<p>in the<em>&nbsp;following dropdown(s)<\/em>&nbsp;select a field name, by which value you want to filter record.&nbsp;Records can be found only by direct fields&#8217; values, it is not possible to provide ranges (e.g. greater than, after, max), instead of this filter out records after <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/retrieve-entities-by-attributes\/\">Retrieve Entities By Attributes<\/a> using <span style=\"color:#ec8f45;\">conditions<\/span> and <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/branch\/\">Branch<\/a>.&nbsp;As values, you may use Constants or the output from Get Entity Attribute operator At least one filter must be entered. Use &#8220;+&#8221; to add another field name. Between all selected fields there is logical AND. &nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Required: yes<\/li><\/ul>\n\n\n\n<p><strong>outputs:<\/strong><\/p>\n\n\n\n<p><span style=\"color:#ef6950;\">entity<\/span> &#8211; contains entity if there is at least one record that meets input criteria. Follows by <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/set-entity-attributes\/\">Set Entity Attributes<\/a> and <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/save-entity\/\">Save Entity<\/a> when the record is new.<\/p>\n\n\n\n<p><span style=\"color:#deb7ca;\">is new<\/span> &#8211; is true if there is no record found by input criteria or false if there is one.<\/p>\n\n\n<p><a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-89-54fa511958a74af0ab2233ee8d88d7b5.png\" rel=\"prettyPhoto\"><img decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-89-54fa511958a74af0ab2233ee8d88d7b5-1024x234.png\" alt=\"\" class=\"wp-image-378\"><\/a><\/p><div style=\"text-align:left\" class=\"yasr-auto-insert-visitor\"><!--Yasr Visitor Votes Shortcode--><div id='yasr_visitor_votes_907' class='yasr-visitor-votes'><div class=\"yasr-custom-text-vv-before yasr-custom-text-vv-before-907\">Click to rate this post!<\/div><div id='yasr-vv-second-row-container-a7022d3deaf96' \n                                        class='yasr-vv-second-row-container'><div id='yasr-visitor-votes-rater-a7022d3deaf96'\n                                      class='yasr-rater-stars-vv'\n                                      data-rater-postid='907' \n                                      data-rating='0'\n                                      data-rater-starsize='24'\n                                      data-rater-readonly='false'\n                                      data-rater-nonce='fa81b01ba5' \n                                      data-issingular='false'\n                                    ><\/div><div class=\"yasr-vv-stats-text-container\" id=\"yasr-vv-stats-text-container-a7022d3deaf96\"><svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" width=\"20\" height=\"20\" \n                               class=\"yasr-dashicons-visitor-stats\"\n                               data-postid=\"907\" \n                               id=\"yasr-stats-dashicon-a7022d3deaf96\">\n                            <path d=\"M18 18v-16h-4v16h4zM12 18v-11h-4v11h4zM6 18v-8h-4v8h4z\"><\/path>\n                          <\/svg><span id=\"yasr-vv-text-container-a7022d3deaf96\" class=\"yasr-vv-text-container\">[Total: <span id=\"yasr-vv-votes-number-container-a7022d3deaf96\">0<\/span>  Average: <span id=\"yasr-vv-average-container-a7022d3deaf96\">0<\/span>]<\/span><\/div><div id='yasr-vv-loader-a7022d3deaf96' class='yasr-vv-container-loader'><\/div><\/div><div id='yasr-vv-bottom-container-a7022d3deaf96' class='yasr-vv-bottom-container'><\/div><\/div><!--End Yasr Visitor Votes Shortcode--><\/div>","protected":false},"excerpt":{"rendered":"<p>Returns record that was found by input filters or creates a new one if there is no record by the provided filters. It works similar to Retrieve Entities By Attributes: provide filters to find records. However it may return only one record that satisfies search criteria, so keep in mind that if there are several &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/logicbuilder.integroscrm.com\/help\/find-or-create-entity\/\"> <span class=\"screen-reader-text\">Find Or Create Entity<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","footnotes":""},"tags":[],"class_list":["post-907","page","type-page","status-publish","hentry"],"yasr_visitor_votes":{"number_of_votes":0,"sum_votes":0,"stars_attributes":{"read_only":false,"span_bottom":false}},"_links":{"self":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/comments?post=907"}],"version-history":[{"count":4,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/907\/revisions"}],"predecessor-version":[{"id":2064,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/907\/revisions\/2064"}],"wp:attachment":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/media?parent=907"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/tags?post=907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}