Created on 17 September 2012, over 12 years ago
Updated 15 January 2013, almost 12 years ago

Hello,

Looking to see if anyone has found a way to import the user images and or event images that are loaded via Salesforce.

This information relates to the images that we are unable at present to import.

Any assistance would be appreciated.

Mark

Field Label: Photo URL

Field Name: Photo_URL

array = photo_url_c

This is the text array that builds out the images:

LEFT( $Api.Enterprise_Server_URL_100, FIND( ".com", $Api.Enterprise_Server_URL_100 ) + 4)& "sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=" & Id & "&operationContext=CHATTER"

The Enterprise WSDL shows:

or the entire array as:

[41] => stdClass Object
(
[autoNumber] =>
[byteLength] => 3900
[calculated] => 1
[calculatedFormula] => LEFT( $Api.Enterprise_Server_URL_100, FIND( ".com", $Api.Enterprise_Server_URL_100 ) + 4)& "sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=" & Id & "&operationContext=CHATTER"
[caseSensitive] =>
[createable] =>
[custom] => 1
[defaultedOnCreate] =>
[deprecatedAndHidden] =>
[digits] => 0
[filterable] => 1
[groupable] =>
[idLookup] =>
[label] => Photo URL
[length] => 1300
[name] => Photo_URL__c
[nameField] =>
[namePointing] =>
[nillable] => 1
[permissionable] =>
[precision] => 0
[restrictedPicklist] =>
[scale] => 0
[soapType] => xsd:string
[sortable] => 1
[type] => string
[unique] =>
[updateable] =>
)

πŸ’¬ Support request
Status

Closed: won't fix

Version

2.0

Component

sf_import

Created by

πŸ‡ΊπŸ‡ΈUnited States mmcintosh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States darrellduane

    I was able to retrieve a file from the ContentVersion object using PHP and cURL with this code snippet. It is using the Drupal 7 Salesforce Suite module.

    <?php
    
      $fullUrl = 'https://test.sandbox.my.salesforce.com/services/data/v60.0/sobjects/ContentVersion/' . $salesforce_entity_id . '/VersionData';
      
      $accessToken = $sfapi->getAccessToken();    
    
      // Use cURL to make the GET request
    
      $ch = curl_init($fullUrl);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer ' . $accessToken,
        'Content-type: application/json',
      ));
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects
      curl_setopt($ch, CURLOPT_FAILONERROR, true); // Report HTTP code > 400 as error
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Do not verify SSL certificate
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return the transfer as a string
      $image_data = curl_exec($ch);
    
      $directory = 'private://imagefiles/';
    
    
      $uri = $directory .  basename($title) . '.' . $filename; // Set the filename
    
      // Save the file data to the specified location
      $saved_file = file_save_data($image_data, $uri, FILE_EXISTS_REPLACE);
    
      // Save the file to the Drupal file system
      // $saved_file  = file_save($file);
    
      // Check if the file was saved successfully
      if ($saved_file) {
        drupal_set_message("The file has been saved successfully.");
      } else {
        drupal_set_message("There was an error saving the file.", 'error');
      }
    
      // Check for errors
      if (curl_errno($ch)) {
        $error_msg = curl_error($ch);
        ds($error_msg, 'cURL Error');
      }
      // Check if the request was successful and write the file
      curl_close($ch);
    ?>
    
Production build 0.71.5 2024