Ajay98's picture
Update app.py
d8e369f verified
raw
history blame
1.11 kB
from simple_salesforce import Salesforce
# Salesforce credentials
username = 'ajayalways411@gmail.com'
password = 'Anuha@310819'
security_token = 'DcroeUKt0Lc4Lpqgzh9dMxEyQ'
domain = 'login' # Use 'test' if using a sandbox
# Connect to Salesforce
sf = Salesforce(username=username, password=password, security_token=security_token, domain=domain)
# Define your custom object API names (replace 'Custom_Object__c' with your actual custom object API names)
custom_object_1 = 'staff__c'
custom_object_2 = 'CustomerDat__c'
# Retrieve records from the first custom object
records_custom_object_1 = sf.query(f"SELECT Name, AdhardCardPhoto__c, pancardPhoto__c, PhoneNumber__c FROM {custom_object_1}")
# Retrieve records from the second custom object
records_custom_object_2 = sf.query(f"SELECT name, AdhardCard__c,contactNumber__c, pancard__c FROM {custom_object_2}")
# Print retrieved records
print("Records from Custom Object 1:")
for record in records_custom_object_1['records']:
print(record)
print("\nRecords from Custom Object 2:")
for record in records_custom_object_2['records']:
print(record)