Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
from simple_salesforce import Salesforce, SalesforceMalformedRequest, SalesforceResourceNotFound
|
| 3 |
|
| 4 |
# Replace these variables with your Salesforce credentials
|
|
@@ -11,28 +10,23 @@ try:
|
|
| 11 |
sf = Salesforce(username=USERNAME, password=PASSWORD, security_token=SECURITY_TOKEN)
|
| 12 |
|
| 13 |
# Define your custom object API names (replace with your actual custom object API names)
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
records_custom_object_2 = sf.query(f"SELECT Name, AdhardCardPhoto__c, pancardPhoto__c, PhoneNumber__c FROM {custom_object_2}")
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
print("\nRecords from Custom Object 2:")
|
| 29 |
for record in records_custom_object_2['records']:
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
# Print the retrieved records
|
| 34 |
-
for record in results['records']:
|
| 35 |
-
print(f"Name: {record['Name']}, PhoneNumber: {record['PhoneNumber__c']}, Photo: {record['photo__c']}")
|
| 36 |
|
| 37 |
except SalesforceMalformedRequest as e:
|
| 38 |
print(f"Malformed request: {e}")
|
|
@@ -40,4 +34,3 @@ except SalesforceResourceNotFound as e:
|
|
| 40 |
print(f"Resource not found: {e}")
|
| 41 |
except Exception as e:
|
| 42 |
print(f"An error occurred: {e}")
|
| 43 |
-
|
|
|
|
|
|
|
| 1 |
from simple_salesforce import Salesforce, SalesforceMalformedRequest, SalesforceResourceNotFound
|
| 2 |
|
| 3 |
# Replace these variables with your Salesforce credentials
|
|
|
|
| 10 |
sf = Salesforce(username=USERNAME, password=PASSWORD, security_token=SECURITY_TOKEN)
|
| 11 |
|
| 12 |
# Define your custom object API names (replace with your actual custom object API names)
|
| 13 |
+
custom_object_1 = 'staff__c'
|
| 14 |
+
custom_object_2 = 'CustomerData__c'
|
| 15 |
|
| 16 |
+
# Retrieve records from the first custom object
|
| 17 |
+
records_custom_object_1 = sf.query(f"SELECT Name, AdhardCard__c, contactNumber__c, pancard__c FROM {custom_object_1}")
|
| 18 |
|
| 19 |
+
# Retrieve records from the second custom object
|
| 20 |
records_custom_object_2 = sf.query(f"SELECT Name, AdhardCardPhoto__c, pancardPhoto__c, PhoneNumber__c FROM {custom_object_2}")
|
| 21 |
|
| 22 |
+
# Print retrieved records
|
| 23 |
+
print("Records from Custom Object 1:")
|
| 24 |
+
for record in records_custom_object_1['records']:
|
| 25 |
+
print(record)
|
| 26 |
|
| 27 |
print("\nRecords from Custom Object 2:")
|
| 28 |
for record in records_custom_object_2['records']:
|
| 29 |
+
print(record)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
except SalesforceMalformedRequest as e:
|
| 32 |
print(f"Malformed request: {e}")
|
|
|
|
| 34 |
print(f"Resource not found: {e}")
|
| 35 |
except Exception as e:
|
| 36 |
print(f"An error occurred: {e}")
|
|
|