Preview:

var userID = $Crm.user.id;
var userName = $Crm.user.first_name; // + " " + $Crm.user.last_name;
var module = $Page.module;
var module_recordID = $Page.record_id;
var recordName = $Page.record._Full_Name;
var userIDString = String(userID);

console.log("This is string:" +userIDString); 
console.log( "This is user id: "+userID); 
/*var currentdate = new Date();

var timesettings = {  year: 'numeric',  month: 'long',  day: 'numeric',  hour: 'numeric',minute: 'numeric',  second: 'numeric',hour12: true, timeZoneName: 'short' };var formattedDateTime = currentdate.toLocaleTimeString('en-US',timesettings);    console.log("time ::::::: ", formattedDateTime);   */

var map = { "Viewed_By": "Last Viewed by - " + userName + " \n " };
var map = { "Last_Viewed_User_ID": +userIDString + " \n "};

// + formattedDateTime 

//console.log(map); 

var datalist = [];datalist.push(map);var param = { "data": datalist };

//console.log("param: ", param); 

var response = ZDK.Apps.CRM.Connections.invoke("crmconn", "https://zohoapis.com/crm/v5/"+module+"/"+module_recordID, "PUT", 2, param, {});

//console.log("Response : ", response);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter