Needing Help with data collection management

Hi @yisrael-wix , @sapirh

I have been working on trying to change an image in a data collection in the backend data.js, I am trying to achieve the following, an image field changes dependent on the value of the field having an item within it. So for example I have been using the “isNotEmpty” on a field and then with this outcome I would like an image field to change after update or event. I have an understanding of what is needed but need help with code.

I provide the code that I have created to date, it currently doesn’t work:

wixData.get(“collection”, wixUsers.currentUser.id)
.then((item) => {
item.verifiedCivilianImage = item.verifiedCivilianImage.src = ‘wix:image://v1/033844_55155ce5e78d48269d58d21e51cf1c28~mv2.png/Red.png#originWidth=144&originHeight=147’;
if (wixData.query(“collection”)
.isNotEmpty(“verifiedStatus”)
.then((item) => {
item.verifiedCivilianImage = item.verifiedCivilianImage.src = ‘wix:image://v1/033844_28d888e9efc24266af4c0ad2c8da1951~mv2.png/Green.png#originWidth=144&originHeight=147’; // updated last name
wixData.update(“collection”, item);
})
);
})

Any help on adapting the code to achieve the image change on field value change would be greatly welcomed.

Best regards

Si