Inject JS Script Activity Identifier issue

Hi Team,

I want to extract server time with I m able to do in chrome console using below code

let srvsec = new Date(fetch_server_time()).getseconds();
let srvms = new Date(fetch_server_time()).getmilliseconds();
console.log(srvsec+“:”+srvms);

but when I m using Inject java script activity getting an error
syntax error unexpected identifier

Unable to fetch what is the error

Thanks and Regards,
Supriya Yenaganti

Hi @supu123

Could you please share some screenshots of how you configured it in Studio?

looks like following that we can do directly within Studio:
grafik

Hi @ppr

This is system time correct?

I want website server time

WhatsApp Image 2022-07-11 at 12.10.01 PM


Thank your for the extra context. It looks like there might be the return missing, as per our documentation and the sample script provided there:

Hi @loginerror

Error message coming up as fetch_server_time() not defined