Update DataTable with current user

I have a non-people picker column in a DataTable called 'Verified by'. Whenever a new record is added to this DataTable, I would like the 'Verified by' column to auto populate which the current SharePoint user name.

Is this possible? Thanks!

image

Hello @ParAvion,

You can set the value of the column in "Data Table" control with the current user name using the following code.

Please replace 'DataTable0' with the internal name of the control. Column0 - is the column InternalName.

  1. New Lines are added to the Top.
    image
fd.spRendered(function() {
	fd.control('DataTable0').$on('change',
    function(e) {
        var username = _spPageContextInfo.userDisplayName;
        fd.control('DataTable0').value[0].Column0 = username;
    });
}); 
  1. New Lines are added to the Bottom
    image
fd.spRendered(function() {
	fd.control('DataTable0').$on('change',
	
    function(e) {
    	var rec = parseInt(fd.control('DataTable0').value.length) - 1;
        var username = _spPageContextInfo.userDisplayName;
        fd.control('DataTable0').value[rec].Column0 = username;
    });
});