{"id":708,"date":"2022-01-06T14:08:50","date_gmt":"2022-01-06T14:08:50","guid":{"rendered":"https:\/\/logicbuilder.integroscrm.com\/help\/?page_id=708"},"modified":"2022-08-02T18:48:45","modified_gmt":"2022-08-02T18:48:45","slug":"cast-to-entity","status":"publish","type":"page","link":"https:\/\/logicbuilder.integroscrm.com\/help\/cast-to-entity\/","title":{"rendered":"Cast To Entity"},"content":{"rendered":"\n<p><a name=\"abstract\"><\/a>Allows to create an Entity from the JSON or to read an Entity from the Variable. Using <span style=\"color:#ec8f45;\">Cast To Entity<\/span> after <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/get-variable\/\">Get Variable<\/a> allows to make a flowchart even more readable by getting rid of links of entity between operators.<\/p>\n\n\n\n<p><strong>inputs:<\/strong><\/p>\n\n\n\n<p><span style=\"color:#9ed267;\">module<\/span> &#8211; link or select directly in the operator the Module which entity should be in the output.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Required: yes<\/li><\/ul>\n\n\n\n<p><span style=\"color:#9ed267;\">value<\/span> &#8211; input JSON that describes entity or link from value with the entity from the Get Variable<\/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:#ec8f45;\">entity<\/span> &#8211; the entity that can be used in <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/get-entity-attributes\/\">Get Entity Attributes<\/a>, <a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/save-entity\/\">Save Entity<\/a>, and other operators that requires entity as input<\/p>\n\n\n\n<p><strong>Example of usage:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><em>Creating Entity from the JSON<\/em><br>For example, there is a JSON that describes an object in a similar way as Sugar Entity structure. Instead of operators <strong><a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/create-entity\/\">Create Entity<\/a><\/strong> and <strong><a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/set-entity-attributes\/\">Set Entity Attributes<\/a><\/strong> following with mapping fields from JSON to Sugar Entity, there is a possibility to use <span style=\"color:#ec8f45;\"><strong>Cast To Entity<\/strong><\/span>. Let\u2019s say there is a JSON like this:<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>{\u200b\n\n&nbsp; \"first_name\": \"Clark\",\n\n&nbsp; \"last_name\": \"Kent\"\n\n}\u200b\u200b\u200b\u200b\u200b\u200b\u200b\u200b<\/code><\/pre>\n\n\n\n<p>With the following flowchart, it is possible to create a new Contact record from this JSON:<\/p>\n\n\n<p><a href=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-7376ddf47c814028a71c32725d26411a.png\" rel=\"prettyPhoto\"><img decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-7376ddf47c814028a71c32725d26411a-1024x320.png\" alt=\"\" class=\"wp-image-378\"><\/a><\/p>\n\n\n<p>As a result, new Contact is added.<\/p>\n\n\n\n<p>2.&nbsp;<em>Get Entity from the Variable<\/em><\/p>\n\n\n\n<p>If you have dozens of links from&nbsp;<em>entity<\/em>&nbsp;port:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-23479539b7fa450196dad8fa19fa3007.png\" alt=\"\" class=\"wp-image-498\" width=\"447\" height=\"248\" srcset=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-23479539b7fa450196dad8fa19fa3007.png 478w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-23479539b7fa450196dad8fa19fa3007-300x166.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/figure>\n\n\n\n<p>\u2026 and have ever thought of how to remove them to make flowchart even more readable \u2013 now it is possible to put Entity in a Variable and then simply use this Variable through <span style=\"color:#ec8f45;\"><strong>Cast To Entity<\/strong><\/span>. Put entity into variable:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-b98ad9299cba450c9b06660aeb67f7d9-1024x270.png\" alt=\"\" class=\"wp-image-501\" width=\"846\" height=\"223\" srcset=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-b98ad9299cba450c9b06660aeb67f7d9-1024x270.png 1024w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-b98ad9299cba450c9b06660aeb67f7d9-300x79.png 300w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-b98ad9299cba450c9b06660aeb67f7d9-768x203.png 768w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-b98ad9299cba450c9b06660aeb67f7d9.png 1243w\" sizes=\"auto, (max-width: 846px) 100vw, 846px\" \/><\/figure>\n\n\n\n<p>And then through <span style=\"color:#ec8f45;\"><strong>Get Variable<\/strong><\/span> and <span style=\"color:#ec8f45;\"><strong>Cast To Entity<\/strong><\/span> use the entity whenever it is needed:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-075215f2961441b88f313251a3d17547-1024x181.png\" alt=\"\" class=\"wp-image-496\" width=\"933\" height=\"165\" srcset=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-075215f2961441b88f313251a3d17547-1024x181.png 1024w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-075215f2961441b88f313251a3d17547-300x53.png 300w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-075215f2961441b88f313251a3d17547-768x136.png 768w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-55-075215f2961441b88f313251a3d17547.png 1440w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/figure>\n<div style=\"text-align:left\" class=\"yasr-auto-insert-visitor\"><!--Yasr Visitor Votes Shortcode--><div id='yasr_visitor_votes_708' class='yasr-visitor-votes'><div class=\"yasr-custom-text-vv-before yasr-custom-text-vv-before-708\">Click to rate this post!<\/div><div id='yasr-vv-second-row-container-ddf3c966e10f9' \n                                        class='yasr-vv-second-row-container'><div id='yasr-visitor-votes-rater-ddf3c966e10f9'\n                                      class='yasr-rater-stars-vv'\n                                      data-rater-postid='708' \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-ddf3c966e10f9\"><svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" width=\"20\" height=\"20\" \n                               class=\"yasr-dashicons-visitor-stats\"\n                               data-postid=\"708\" \n                               id=\"yasr-stats-dashicon-ddf3c966e10f9\">\n                            <path d=\"M18 18v-16h-4v16h4zM12 18v-11h-4v11h4zM6 18v-8h-4v8h4z\"><\/path>\n                          <\/svg><span id=\"yasr-vv-text-container-ddf3c966e10f9\" class=\"yasr-vv-text-container\">[Total: <span id=\"yasr-vv-votes-number-container-ddf3c966e10f9\">0<\/span>  Average: <span id=\"yasr-vv-average-container-ddf3c966e10f9\">0<\/span>]<\/span><\/div><div id='yasr-vv-loader-ddf3c966e10f9' class='yasr-vv-container-loader'><\/div><\/div><div id='yasr-vv-bottom-container-ddf3c966e10f9' class='yasr-vv-bottom-container'><\/div><\/div><!--End Yasr Visitor Votes Shortcode--><\/div>","protected":false},"excerpt":{"rendered":"<p>Allows to create an Entity from the JSON or to read an Entity from the Variable. Using Cast To Entity after Get Variable allows to make a flowchart even more readable by getting rid of links of entity between operators. inputs: module &#8211; link or select directly in the operator the Module which entity should &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/logicbuilder.integroscrm.com\/help\/cast-to-entity\/\"> <span class=\"screen-reader-text\">Cast To 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-708","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\/708","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=708"}],"version-history":[{"count":4,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/708\/revisions"}],"predecessor-version":[{"id":2036,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/708\/revisions\/2036"}],"wp:attachment":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/media?parent=708"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/tags?post=708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}