Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -68,15 +68,24 @@ print(sf.UserInfo) # This will give you the user info if the connection is succ
|
|
68 |
# Function to create Salesforce record
|
69 |
def create_salesforce_record(name, email, phone_number):
|
70 |
try:
|
|
|
71 |
customer_login = sf.Customer_Login__c.create({
|
72 |
'Name': name,
|
73 |
'Email__c': email,
|
74 |
'Phone_Number__c': phone_number
|
75 |
})
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
return customer_login
|
78 |
except Exception as e:
|
79 |
-
#
|
80 |
error_message = str(e)
|
81 |
print(f"Error creating Salesforce record: {error_message}")
|
82 |
return {"error": f"Failed to create record in Salesforce: {error_message}"}
|
|
|
68 |
# Function to create Salesforce record
|
69 |
def create_salesforce_record(name, email, phone_number):
|
70 |
try:
|
71 |
+
# Attempt to create a record in Salesforce
|
72 |
customer_login = sf.Customer_Login__c.create({
|
73 |
'Name': name,
|
74 |
'Email__c': email,
|
75 |
'Phone_Number__c': phone_number
|
76 |
})
|
77 |
+
|
78 |
+
# Log the response from Salesforce
|
79 |
+
print(f"Salesforce response: {customer_login}")
|
80 |
+
|
81 |
+
if customer_login.get('id'):
|
82 |
+
print(f"Record created successfully with ID: {customer_login['id']}")
|
83 |
+
else:
|
84 |
+
print("No ID returned, record creation may have failed.")
|
85 |
+
|
86 |
return customer_login
|
87 |
except Exception as e:
|
88 |
+
# Catch and log any exceptions during record creation
|
89 |
error_message = str(e)
|
90 |
print(f"Error creating Salesforce record: {error_message}")
|
91 |
return {"error": f"Failed to create record in Salesforce: {error_message}"}
|