Questions tagged [python]

Python is a widely used easy to learn programing language with which one can automate a lot of salesforce tasks by writing scripts. There are python packages like beatbox among others which are salesforce clients and support commands like SOQL queries, upsert, updating, and creating records in salesforce.

Filter by
Sorted by
Tagged with
1
vote
1answer
40 views

Dynamically Update and Insert Records using Simple-Salesforce Library

I am using the Python Simple-Salesforce Library for bulk insert and updating records. I want to create one method in which I pass the Sobject API name and then at run time have it insert/update ...
1
vote
1answer
79 views

Python Simple-Salesforce - Import related records with an external ID

Some time ago I've started to use Python with Pandas and Simple-Salesforce to make data migration to Salesforce orgs. I want to insert Account records and Contact records that have lookup to Account ...
0
votes
1answer
30 views

Merging Account Records Using SOAP With Python

I'm working on trying to merge a list of records in Salesforce via the SOAP API using Python. I am able to get a Postman POST request to work, but I am running into a roadblock with getting the SOAP ...
0
votes
0answers
16 views

Rendered subject not appearing in sent event on python fuelsdk

I'm looking to pull the rendered subject from a sent event object as it's listed in the SFMC API docs https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/sentevent.htm. ...
1
vote
0answers
34 views

Fuel SDK | Python | rename data extension field name/attribute name

Is it possible to update the Field name of an existing data extension using Fuel SDK? My requirement: Change field name from 'Country' to 'Country_code' I was able to get the CustomerKey of required ...
0
votes
1answer
25 views

Merging Accounts on SOAP API While Preserving Data

I am working on some code right now to merge Accounts in Salesforce, but when I need to merge accounts I need to have certain fields preserved in case the victim account has something that needs to be ...
1
vote
1answer
105 views

Django Heroku: remaining connection slots are reserved for non-replication superuser connections

I recently deployed an app to Heroku using Postgres free tier as database. I am using Django 3.2 Everything was working fine until I started getting a mail with the following error: Internal Server ...
0
votes
1answer
62 views

How to read version data in Salesforce

From Salesforce File, I want read the file and get the content between some text and store it in the Custom object record field. For this i have created external API(python script deployed to heroku) ...
1
vote
0answers
27 views

Invalid state when logging into connected python web app

I am having trouble setting up Salesforce as an auth provider for my Django application using Django Allauth, getting "No_Oauth_State: State was not valid" whenever I try to log in. What I'...
1
vote
1answer
235 views

Python Simple Salesforce - Upsert to CampaignMembers Object

I am trying to find an automated way to add contacts & leads to existing campaigns by using simple salesforce to upsert records to the CampaignMembers object. I have a CSV file with CampaignId and ...
0
votes
0answers
55 views

Create Apex Trigger / Class using Python [duplicate]

I am trying to automate a few things for Salesforce using Python. I am using OAuth for Rest API for other processes like creating or updating records. I need to figure out how to create Apex Trigger/...
0
votes
1answer
73 views

Execute Anonymous via Simple_Salesforce throwing EOF exception

I'm attempting to execute a simple anonymous Apex script via Python with the simple_salesforce library. from simple_salesforce import Salesforce sf = Salesforce(instance=scratch_org_instance, ...
0
votes
0answers
68 views

FilterPart in Python Zeep

I am trying to extract data using Python Zeep module from SF DataExtention.Can anyone please help me to write the correct dictionary for Filterpart of Retrieve request. I am trying to pass the ...
1
vote
0answers
124 views

BulkAPI v2 with python fails while the same request with postman works fine

I am trying to get some query results using bulk api from Python. I have been able to get the token but I run into an error when I try to create the batch job based on documentation but I run into ...
1
vote
1answer
901 views

REST API: Error 'METHOD_NOT_ALLOWED' - PATCH

I am trying to upload new records by calling a REST API but am getting the following error. simple_salesforce.exceptions.SalesforceGeneralError: Error Code 405. Response content: [{'errorCode': '...
1
vote
1answer
83 views

OAuth2.0 JWT bearer token flow with alg HS256 issue

I have written the below python code for JWT integration: from datetime import datetime import jwt import time import requests # *** Update these values to match your configuration *** IS_SANDBOX = ...
0
votes
0answers
96 views

Dash/Flask python app returning R15 out of memory error at 100% of the free dyno memory

Since 3 days ago, my dash app is crashing with R15 out of memory error, after reaching 512 MB memory usage (100% of free dyno). It was running for several months without any issues at 180%, and ...
2
votes
1answer
604 views

Object of type datetime is not JSON serializable

I'm new using Simple_Salesforce for Python and I'm trying to update a record of "Account" and one of the values that I need to update is a Date/Time value, but I'm receiving the error: "...
0
votes
1answer
45 views

Is there any way to cache the salesforce data using "simple_salesforce" python library

In my python application, I used "simple_salesforce" library to fetch data from salesforce. Instead of hitting an API every time I would expect salesforce to return data from cache instead ...
0
votes
0answers
62 views

Salesforce API totalSize does not always match to the number of rows returned

I am downloading data from salesforce API. The table is big and I am using query_more to get full result. The problem is totalSize returned in result does not always match to the actual number of ...
0
votes
1answer
55 views

Encoding problems from Python to Salesforce

we are working with a third-party CPQ tool. A lot of information between both systems are transferred via Python. IronPython 2.7.5 is the used Python version. In one part of the script I´m creating ...
0
votes
1answer
72 views

Working with Python on Salesforce

Sorry guys I have to update my question to give more clarity on my thoughts/doubts I did research from official documentation from salesforce but didn't quite get anything useful. I am curious to know ...
0
votes
0answers
46 views

What is the best way to do Automation?

I'm running into issues with Cypressio and Selenium, and I'm pretty new to automation testing within Salesforce. What is the best thing to do? How to do it? & what are the tools that you recommend ...
1
vote
1answer
1k views

Using simple-salesforce with oAuth

I have a need to query salesforce data through a django app. I am currently using simple-salesforce to do this on our QA salesforce using a username, password and a security token. Now that I am ...
0
votes
1answer
115 views

Combine multiple select statements in SOQL and python

I am trying to combine three columns(same data type) from three tables. I am receiving a malformed request error that I can't quite figure out. Initially I tried a UNION ALL but I learned that SOQL ...
0
votes
1answer
192 views

Is there a Python library that allows you to merge duplicate accounts in salesforce? [closed]

I would like to merge 10000 accounts who already have a master account assigned to them. This was done on an Excel file manually. I usually use the simple-salesforce API to update SF records, however ...
0
votes
1answer
78 views

SFMC API Integration using Python

Getting the following error when trying to integrate SFMC using Python. Can someone help me with this? File "/Users/abhinavagrawal/Desktop/sfmc_new.py", line 17, in <module> '...
0
votes
1answer
569 views

Consolidated Answer: How to extract a SF report using Python [closed]

I've been searching around the site for the past week or two and there seem to be a lot of opinions and ideas on how to download a report into a DataFrame from SF using Python (simple-salesforce & ...
0
votes
1answer
100 views

How to get a record with all data associated with it using Python?

I need a bit of direction I am looking for a way to acquire all the data associated with a client/lead/record inside Salesforce. I have looked all over the place, and most tutorials only talk about ...
0
votes
0answers
212 views

Would anyone be able to share an example of pk_chunking working using the python bulk api

I’m new to python and Sales Force. I have a bulk api extract job working and would like to add pk_chunking. I use the python library: from salesforce_bulk import SalesforceBulk Adding pk_chunking ...
0
votes
1answer
135 views

simple_salesforce python how to rewrite this using bind variables

revenue = sf.query("SELECT Id, Name, Net_Revenue__c, Price__c, Credits__c, Gross_Revenue__c, Account__r.Name \ FROM Revenue__c WHERE Account__r.Id = '"+accountId+"' and MonthYear__c ...
1
vote
1answer
640 views

Dynamic simple_salesforce query with list of ids

This 2nd format_soql is not working. I have tried replacing the single quotes to double quotes as per the format defined here: https://github.com/simple-salesforce/simple-salesforce#queries query1 = &...
0
votes
1answer
66 views

Need Post Request format for Live app Insertion in quip via API

Is there an Example for insertion live app into Quip document via API Edit API Content-Type: application/x-www-form-urlencoded Authorization: Bearer {{access_token}} User-Agent: PostmanRuntime/7.26.7 ...
1
vote
1answer
117 views

Salesforce to Salesforce Migration

We are doing Salesforce (old instance) to Salesforce (new instance) migration. We have Standard and custom objects in our old instance which are needed to be migrated to the new Salesforce instance. ...
0
votes
0answers
17 views

Fuel SDK Python scope mismatch [duplicate]

I'm trying to use the Marketing Cloud FuelSDK with Python to retrieve data extensions. However, I'm getting this error regarding scopes, no matter what I seem to do. I created a server-to-server API ...
0
votes
0answers
65 views

Can't download data from _MobileSubscription table using FuelSDK and python

I've set up FuelSdk on my airflow machine and I want to download some data from the _MobileSubscription table. but when I have a column starting with underscrore I'm getting this message Failed to get ...
2
votes
1answer
324 views

How to upload BLOB using the Quip API

Is it possible to upload an audio file using the Quip API? I see in the documentation the API supports the upload of blob objects. I can't seem to get this to work properly. I have tried uploading ...
0
votes
1answer
574 views

Can we use Node.js in Marketing Cloudpages?

We are planning to make Web scrapping tool in cloud pages using node.js . I want to know can we use node.js libraries and function in cloudpages ? We have a Url of a web page as input .Request {Url} ...
0
votes
1answer
230 views

Setting picklist values - salesforce python api

I am using the salesforce API and struggling to figure out when (and how best?) to set picklist values for different fields. Here is a code example: from simple_salesforce import Salesforce, ...
0
votes
0answers
20 views

I want to access Notes from Salesforce I am getting the response in from of url how to get my actual data from it? [duplicate]

SOQL QUERY -cn = "SELECT Title,Content FROM ContentNote" OUTPUT OF Content:/services/data/v42.0/sobjects/ContentNote/0692x000000WFDAAA4/Content
0
votes
1answer
190 views

How to get my actual data from ContentNote API in Salesforce using SOQL?

My Notes has Title-Task2 and Content is "Talk to customers" When I run following query: SELECT Title,Content FROM ContentNote Output is: ('Title', 'Task2'), ('Content','/services/data/v42.0/...
0
votes
1answer
613 views

Error Salesforce data query - [{'message': 'INVALID_HEADER_TYPE', 'errorCode': 'INVALID_AUTH_HEADER'}]

I am trying the get data from Salesforce using simple_salesforce python package. But I am getting Response content: [{'message': 'INVALID_HEADER_TYPE', 'errorCode': 'INVALID_AUTH_HEADER'}] when I ...
-3
votes
1answer
611 views

Execute python script through Apex class [closed]

I have a custom button in Salesforce and a python script which takes the data from Accounts table, perform some logic and save it in an object I want to execute python script by clicking the custom ...
0
votes
1answer
102 views

python SDK getMoreResults() doesn't retrieve any result

I am retrieving some DE rows that for sure have more results. The code: client = FuelSdkClient(clientId) #FuelSdkClient is a def where I am instantiating a client through a specific account row = ...
1
vote
1answer
533 views

passing a variable in SOQL select statement with python and simple-salesforce

I am trying to pass a variable into SOQL statement, I am using simple_salesforce library. I only need to grab the data when CreateDate of the Opportunity is > than yesterday, yesterday's date is saved ...
0
votes
1answer
588 views

Python with Simple Salesforce dynamic SOQL query issue: ERROR at Row:1:Column:98\nline 1:98 no viable alternative at character '\\'",

I have to retrieved data from a SOSL query using simple saleforce with no issues. This query will search for duplicate leads or contacts in Salesforce and then get the multiple records retrieved and ...
0
votes
1answer
274 views

Python: ContentVersion.VersionData throwing Incorrect padding while decoding to base64 string

I have the following Python code using Simple_Salesforce module: def get_email_template(sf, agreement_id): email_templates = sf.query(f""" SELECT VersionData, Title, PathOnClient ...
0
votes
0answers
90 views

extract data from the child BU

I have several BUs that are children of a sabe BU. I am trying to extract data with the python FuelSDK by creating a client id and a client secret. The thing is that I can only extract data from the ...
2
votes
1answer
392 views

How to find Unused methods in Apex Class?

I am aware there are couple questions already been asked for this use case and I went through Andrew Fawcett blog post having tool as a canvas app Spring Cleaning Apex Code with the Tooling API I am ...
1
vote
1answer
92 views

Getting associated email info using job/send id

I'm using Python and the associated Fuel SDK package to make API calls to SalesForce Marketing Cloud. I'm attempting to consolidate information from various cloud objects to obtain the same ...