AjaykumarPilla commited on
Commit
7e8f8cb
·
verified ·
1 Parent(s): c5e68f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 internal 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 not update_result == 204: # 204 indicates success for updates
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