Issue
As a new user on Appsmith, I wrote a script that runs a query and takes an action based on the response. However, there was a red line under "response" in the script, indicating that it was not defined. I realized that I used "responce" in one part of the code and "response" in another. Once I fixed this, the issue was resolved.
Resolution
The issue identified is that there is a typo in the script where the variable name "response" is misspelled as "responce". This is causing the error "response is not defined" as the script is not recognizing the correct variable name.
To resolve the issue, the variable name needs to be corrected throughout the script. The correct variable name is "response", so the code should read:
export default {
test: () => {
SelectActiveUser.run().then((response) => {
if (response.length > 0) {
showAlert("Success", 'success');
}
else {
showAlert("Failure Login", 'error');
}
})
}
}
By making this correction, the script should now run without any errors.