`salesforce` Provide direct helper function for file uploads
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24
- Forks
- 41
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 12
Description
Clients occasionally need to send files to Salesforce—the use case would be to fetch a file from X or Y SFTP server and then load it to SF. Consider, do we stream? How do we avoid saving the file to state between jobs? How do we minimize the memory usage of the NodeVM?
This looks good: https://github.com/jsforce/jsforce/issues/43#issuecomment-80522041 . Should we provide a helper function to wrap this up for the adaptor?
'use strict';
var fileOnServer = '/home/ubuntu/myuploaddir/randomfile/randomimage.jpg',
fileName = 'MyRandomImage.jpg',
fileType = 'image/jpeg';
fs.readFile(fileOnServer, function (err, filedata) {
if (err){
console.error(err);
}
else{
var base64data = new Buffer(filedata).toString('base64');
jsForceConn.sobject('Attachment').create({
ParentId: 'mysalesforceContactID',
Name : fileName,
Body: base64data,
ContentType : fileType,
},
function(err, uploadedAttachment) {
console.log(err,uploadedAttachment);
});
}
});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is named. Start with the Salesforce Attachment upload example in the issue and the linked jsforce discussion, then determine the adaptor entry point and how streaming, job state, and NodeVM memory should be handled. Done means a defined helper interface and tests covering the intended upload behavior and resource constraints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100