{"id":3353,"date":"2020-07-08T22:20:39","date_gmt":"2020-07-08T20:20:39","guid":{"rendered":"http:\/\/van-maanen.com\/?p=3353"},"modified":"2020-07-08T22:20:39","modified_gmt":"2020-07-08T20:20:39","slug":"write-records-to-salesforce","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=3353","title":{"rendered":"Write records to Salesforce"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Below, I provide a simple programme. The programme is written in Python. With Python, a library &#8220;salesforce_api&#8221; is used.  With this library, one is able  to insert records, query records and delete records in Salesforce.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from salesforce_api import Salesforce\nclient = Salesforce(username='datamigrationuser@pension4you.nl.pensiond2', password='***', security_token='***',is_sandbox=True)\nhx = client.sobjects.Contact.insert({'LastName': 'Example', 'Email': 'test@example.com'})\nprint(hx)\nhx = client.sobjects.query(\"SELECT Id FROM Contact WHERE LastName='Example'\")\nhx = client.sobjects.Contact.delete(hx[0]['Id'])\nprint(hx)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Below, I provide a simple programme. The programme is written in Python. With Python, a library &#8220;salesforce_api&#8221; is used. With this library, one is able to insert records, query records and delete records in Salesforce. from salesforce_api import Salesforce client = Salesforce(username=&#8217;datamigrationuser@pension4you.nl.pensiond2&#8242;, password=&#8217;***&#8217;, security_token=&#8217;***&#8217;,is_sandbox=True) hx = client.sobjects.Contact.insert({&#8216;LastName&#8217;: &#8216;Example&#8217;, &#8216;Email&#8217;: &#8216;test@example.com&#8217;}) print(hx) hx = client.sobjects.query(&#8220;SELECT Id [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3353","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3353"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3353\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3353"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}