I am trying to update a custom field on the Product2 object, namely S3_Image__c - it is a URL field, linking to an image on AWS S3.
Now, I've basically lifted the code from the examples given on the nforce github, and I believe I have the syntax right.
When I run it, the error I am getting is:
Error: Provided external ID field does not exist or is not accessible: undefined
I have tried setting an external ID and I've tried entering dummy data in S3_Image__c, in case it shouldn't be blank. I am basically out of ideas. Any help would be appreciated!
I've included a lot of code but I don't want to miss a key detail. Sorry if it's too much.
function uploadS3Path(filetype, s3url){
var outcome;
return new Promise ( result => {
var queryFileUpdate = 'SELECT S3_Image__c FROM Product2 WHERE Id = \'01t2w000006aKY5AAM\'';// + Id__c;
querySFDC(queryFileUpdate).then( result => {
if(result.length > 0) {
var acc = result[0];
if(filetype == 'PDF'){
acc.set('S3_PDF__c', s3url);
}
else{
acc.set('S3_Image__c', s3url);
}
org.update({ sobject: acc }).then( result => {
console.log(result);
return result;
}).catch(error => {
console.error(error);
});
}
});
});
}
function querySFDC(query) {
return new Promise( result => {
var queryresult;
console.log("Query Running: " + query);
org.query({ query: query }).then( results => {
if (results.records.length > 0) {
queryresult = results.records;
} else {
console.log("Returned No records");
}
result(queryresult);
});
});
}
S3_Image__c
as an external ID field, but the error message indicates it as external ID field. This tells me that the code while trying to query the SObject was able to identify the field as external ID field. So, I would interpret this message asProvided external ID field is not accessible
. You are probably using an user account to authenticate to the org usingorg.authenticate
nforce function. Does this user have access to the external ID field? – arut Aug 26 '20 at 6:59nforce
to query an URL field created inAccount
object. Didn't get any error. – arut Aug 26 '20 at 15:09S3_PDF__c
but not querying for it. Could that be causing the problem? May be provide some more details like where exactly does your code run into this error. – arut Aug 26 '20 at 15:11