Skip to main content

Hi,


I am using a webhook triggered script to copy incoming data into 2 tables. None of the updated columns are links.



let uwTable = base.getTable("ATDS data");

let crTable = base.getTable("Combined repository 2")



let inputData = input.config()

console.log(inputData)



let validateRecord = async (newApplicationNumber) => {

if(!newApplicationNumber || newApplicationNumber === "") {

return true

} else {

let exisitingCases = await uwTable.selectRecordsAsync({fields:["Application No."]});

let existingApplicationNumbers = exisitingCases.records.map(r => r.getCellValueAsString("Application No."));

console.log(exisitingCases.records.map(r => r.getCellValueAsString("Application No.")));

console.log(newApplicationNumber)

return existingApplicationNumbers.includes(newApplicationNumber) ? false : true;

}

}



let isValid = await validateRecord(inputData.application_number);



//adding case to Combined repository 2 w/o validation

await crTable.createRecordAsync({

"Repository Record ID": inputData.repository_record_id,

"Hub": {name: inputData.hub},

"City": {name: inputData.city},

"APPLICATION NUMBER":inputData.application_number,

"Phone": inputData.phone,

"Merchant Name": inputData.merchant_name,

"Father name": inputData.father_name,

"Documents link": inputData.documents_link,

"Loan Amount": inputData.loan_amount,

"Tenure": inputData.tenure,

"Finbox Status": inputData.finbox_status,

"Is Valid": isValid ? {name: "Yes"} : {name: "No"}

});



//adding case to ATDS cases with validation



if(isValid) {

await uwTable.createRecordAsync({

"Repository Record ID": inputData.repository_record_id,

"Hub": {name: inputData.hub},

"City": inputData.city,

"Application No.":inputData.application_number,

"Phone no.": inputData.phone,

"Drive Link": inputData.documents_link,

})

}



I arbitrarily (only for a few cases) get the below error:



Error: Field "fldOx0V2uAPlLp6LQ" cannot accept the provided value.

at main on line 22



Sharing the input data:




I have gone through other threads with a similar issue, but wasn’t able to find a fix. Any help would be appreciated

First, find the name of the field that has the ID given in the error message. You can get field IDs from the Manage Fields feature or from scripting.



Then identify the field type of the field in question.



Then find the write format for that field type.



Then identify the data format that you are sending. The data type is often obscured in the input that you see in the screen shot. For example, it can be hard to tell the difference between a string, a number, and an array.



Then convert your input data to the required write format.



My guess is that the {Loan Amount} is a string when it needs to be a number. But it could be another field.


Reply