Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -156,12 +156,12 @@ def save_to_salesforce(input_data, prediction, pdf_buffer):
|
|
| 156 |
# Get the ContentVersion ID
|
| 157 |
content_version_id = cv_result["id"]
|
| 158 |
|
| 159 |
-
# Construct the
|
| 160 |
pdf_url = f"{os.environ.get('SF_INSTANCE_URL')}/sfc/servlet.shepherd/version/download/{content_version_id}"
|
| 161 |
|
| 162 |
# Update the Delay_Predictor__c record with the PDF URL
|
| 163 |
update_result = sf.Delay_Predictor__c.update(record_id, {"PDF_Report__c": pdf_url})
|
| 164 |
-
if
|
| 165 |
return f"Failed to update PDF_Report__c field: {update_result}"
|
| 166 |
|
| 167 |
return None
|
|
|
|
| 156 |
# Get the ContentVersion ID
|
| 157 |
content_version_id = cv_result["id"]
|
| 158 |
|
| 159 |
+
# Construct the correct Salesforce URL for the ContentVersion
|
| 160 |
pdf_url = f"{os.environ.get('SF_INSTANCE_URL')}/sfc/servlet.shepherd/version/download/{content_version_id}"
|
| 161 |
|
| 162 |
# Update the Delay_Predictor__c record with the PDF URL
|
| 163 |
update_result = sf.Delay_Predictor__c.update(record_id, {"PDF_Report__c": pdf_url})
|
| 164 |
+
if update_result != 204: # 204 indicates success for updates
|
| 165 |
return f"Failed to update PDF_Report__c field: {update_result}"
|
| 166 |
|
| 167 |
return None
|