Search code examples
salesforcejitterbit

Jitterbit data loader giving issue while fetching attachment from salesforce


Jitterbit data loader giving access issue while fetching attachment from salesforce. I'm able to fetch .pdf and .jpeg files from salesforce but it is giving access issue while tetching .csv and flat files from salesforce to other system. Below is the issue it shows after completion of job

The operation "Query Attachments (3)" completed successfully.

Information

Failed to evaluate target: Body and the instance list is 1;. Failed to write to the target "SFTP Target". Reason: Failed to put the local file C:/Windows/Temp/jitterbit_dl6/CachedTargets/T_544538/1c7cbc33-05ca-4e38-abdf-2b8c62ebf917 to the url /Manual-TCI-CSV-2016-08-23 11:20:33.csv Failed to put data to the url /Manual-TCI-CSV-2016-08-23 11:20:33.csv. Access denied to remote resource. Upload failed: Permission denied (3/-31). Error occurred when evaluating function at line 7 FlushFile( Failed to write to the target "SFTP Target". Reason: Failed to put the local file
C:/Windows/Temp/jitterbit_dl6/CachedTargets/T_544538/1c7cbc33-05ca-4e38-abdf-2b8c62ebf917 to the url /Manual-TCI-CSV-2016-08-23 11:20:33.csv Failed to put data to the url /Manual-TCI-CSV-2016-08-23 11:20:33.csv. Access denied to remote resource. Upload failed: Permission denied (3/-31). Error occurred when evaluating function at line 7 FlushFile( Failed to evaluate target: Body and the instance list is 1;. Failed to write to the target "SFTP Target". Reason: Failed to put the local file C:/Windows/Temp/jitterbit_dl6/CachedTargets/T_544538/1c7cbc33-05ca-4e38-abdf-2b8c62ebf917 to the url /Manual-TCI-CSV-2016-08-23 11:20:33.csv Failed to put data to the url /Manual-TCI-CSV-2016-08-23 11:20:33.csv. Access denied to remote resource. Upload failed: Permission denied (3/-31). Error occurred when evaluating function at line 7 FlushFile(

Below is the code I'm using to write file to other system :

$body = Base64Decode(root$transaction.response$body$queryResponse$result$records.Attachment$Body$);
$name = root$transaction.response$body$queryResponse$result$records.Attachment$Name$; 
WriteFile("<TAG>Targets/Files/Attachment</TAG>", $body, $name); 
FlushFile("<TAG>Targets/Files/Attachment</TAG>", $name);

Please let me know what should I do?


Solution

  • It looks like you're on Windows but retrieving files generated on Unix/Linux/MacOS. You won't be able to write a file with the following name:

    Manual-TCI-CSV-2016-08-23 11:20:33.csv

    Reason is that the colon character (":") is a separator in Windows OS, it indicates a drive letter hence cannot be used in file names.

    • You could find a Mac or Linux box and run the same Jitterbit Job. All files will be transferred, then it will be down to you to rename them using a safe name (https://support.apple.com/en-gb/HT202808).
    • Other option is to include in your code some Regex to search the character ":" and replace it with "-" for instance before downloading.

    Hope this helps. :)