I am trying to update a value fetched from a Mongo database when I click on it. I have created an event to be triggered on a click to run this script:
const orderID = listCollection1.selectedItem.id;
const newStatus = "Under progress";
if (orderID) {
updateStatus.trigger({
additionalScope: {
orderID: orderID,
newStatus: newStatus
}
});
} else {
console.log("No valid order ID found.");
}
I have attached the screenshot of the UpdateStatus query.
Now when I click the item I keep getting this error:
updateStatus failed (0.336s):The value given - `{id : null` must be valid JSON.
updateStatusfrom updateStatus response(updateStatus)
▶in updateStatus.trigger()(updateStatus)
orderID }: null
▶additionalScope: {orderID: "1", newStatus: "Under progress"}
environment: "production"
in run script(listCollection1)
in listCollection1 press event handler(listCollection1)
from user interaction
It's saying that the orderID is null but in additional scope it is visible that orderID is 1.
I need to rectify this issue.