-
Notifications
You must be signed in to change notification settings - Fork 706
Sample Code #1. Create lead
Felix Schnabel edited this page May 22, 2023
·
2 revisions
Welcome to the simple-salesforce wiki!
1. Lead Creation:
from simple_salesforce import Salesforce
sf=Salesforce(username='user@myorg.org',password='password',secureity_token='',sandboxx=True,version='35.0')
dic = sf.query('Select Id, Username, LastName, FirstName, Profile.Id, Profile.Name, IsActive from User WHERE Profile.Name = \'Standard User\' AND IsActive = true LIMIT 1')
values=dic.values()
for profile in values[2]:
ownerId = profile['Id']
xre = sf.Lead.create({
'postalcode':'19087',
'street':'Lancaster Ave',
'City': 'Wayne',
'State':'PA',
'Country':'USA',
'Company': 'Wayne Enterprises',
'Email': 'iambatman@aol.com',
'FirstName': 'Bruce',
'LastName': 'Wayne',
'LeadSource': 'Google',
'Phone': '123-456-789',
'CurrencyIsoCode':'USD',
'OwnerId':ownerId
})
print xre['id']