You need to sign in to do that
Don't have an account?
Abilash.S
Bad Request 400 for standard Lightning upload file
I am using lighning upload file tag to upload files for customer from community portal.
<lightning-file-upload class="fileUploader"
accept={acceptedFile}
onuploadfinished={handleUploade}
></lightning-file-upload>
Till yesterday it was worked , today onwards not working saying bad request in console logs.
It worked multiple times, not sure today its not working. Didnt done any code changes.
Help me out of this.
JS-
handleUploade(event){
this.updatingloader = true;
const uploadedFile = event.detail.files;
uploadedFile.forEach(element => {
this.uploadedFileName = element.name;
});
if(this.selectedRT == 'MM'){
}
else if(this.selectedRT == 'ULT'){
readUploadedFile({DocumentId:uploadedFile[0].documentId})
.then(result => {
//console.log('result raw data from csv file ===>',result);
let res = JSON.parse(result);
console.log(res);
this.rawInsertedCLi = result;
let dataToShow = [];
res.forEach(rowElement => {
let rowObj ={};
if(this.selectedRT == 'ULT'){
rowObj.SerialNo = rowElement.SerialNo;
rowObj.ReturnQuantity = rowElement.ReturnQuantity;
rowObj.VISID = rowElement.VISID;
rowObj.PO_Number = rowElement.PO_Number;
rowObj.CR_DBT = rowElement.CR_DBT;
rowObj.Org_PO = rowElement.Org_PO;
rowObj.Product_condition = rowElement.Product_condition;
rowObj.product_verify = rowElement.product_verify;
rowObj.CLIRInsertedID = rowElement.RecordId;
}
dataToShow.push(rowObj);
});
this.PoData = dataToShow;
console.log('raw csv data to object maping :'+this.PoData);
if(this.PoData != '' && this.PoData != undefined){
//this.dataToValidate(this.PoData);
//this.callExternalSource(this.PoData); //uncomment for previous func
this.showInsertedRows = true;
this.updatingloader = false;
this.recordstosend = this.PoData;
this.hideToValidateStep = false;
}
<lightning-file-upload class="fileUploader"
accept={acceptedFile}
onuploadfinished={handleUploade}
></lightning-file-upload>
Till yesterday it was worked , today onwards not working saying bad request in console logs.
It worked multiple times, not sure today its not working. Didnt done any code changes.
Help me out of this.
JS-
handleUploade(event){
this.updatingloader = true;
const uploadedFile = event.detail.files;
uploadedFile.forEach(element => {
this.uploadedFileName = element.name;
});
if(this.selectedRT == 'MM'){
}
else if(this.selectedRT == 'ULT'){
readUploadedFile({DocumentId:uploadedFile[0].documentId})
.then(result => {
//console.log('result raw data from csv file ===>',result);
let res = JSON.parse(result);
console.log(res);
this.rawInsertedCLi = result;
let dataToShow = [];
res.forEach(rowElement => {
let rowObj ={};
if(this.selectedRT == 'ULT'){
rowObj.SerialNo = rowElement.SerialNo;
rowObj.ReturnQuantity = rowElement.ReturnQuantity;
rowObj.VISID = rowElement.VISID;
rowObj.PO_Number = rowElement.PO_Number;
rowObj.CR_DBT = rowElement.CR_DBT;
rowObj.Org_PO = rowElement.Org_PO;
rowObj.Product_condition = rowElement.Product_condition;
rowObj.product_verify = rowElement.product_verify;
rowObj.CLIRInsertedID = rowElement.RecordId;
}
dataToShow.push(rowObj);
});
this.PoData = dataToShow;
console.log('raw csv data to object maping :'+this.PoData);
if(this.PoData != '' && this.PoData != undefined){
//this.dataToValidate(this.PoData);
//this.callExternalSource(this.PoData); //uncomment for previous func
this.showInsertedRows = true;
this.updatingloader = false;
this.recordstosend = this.PoData;
this.hideToValidateStep = false;
}
Does this happen in a specific sandbox/prod org or across all your orgs? Thanks