Capturing current user id

Hi,
I need to capture the current user Id to insert it in a new item of a collection.
My code:

import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;

export function button13_onclick() {

let DATO = $w(“#input21”).value;
let usuario = $w (wixUsers.currentUser.id);

let insert = {
“id_evento”: DATO,
“usuario”: usuario,
};

$w.onReady( () => {
$w(“#dataset6”).onReady( () => {
wixData.insert(“PROTOCOLOS”, insert);
$w(“#dataset6”).save();

} );

} );

$w(“#dataset6”).refresh();

}
Using this code, I have a validation error. The data I insert in the id field is JS type instead of text type.
Someone may help me?

Hi,
You should change the following line to -
let usuario = wixUsers.currentUser.id ;
check out the API here
Good luck

Hi Or,
Thank you very much!!

I have tried every variance on pulling data such as emails and id, etc…none work correctly. it is a 50/50 shot if they pull info. There has to be a problem within Wix database system as all variations “tried and true codes” end up breaking down and not working for site visitors…sometimes they work, sometimes they do not