Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Update: Narrative Insights has been restored and is now available.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Get hours difference from Date/Time field with current Date/Time
Hi,
I'm trying to get the difference between field Date/Time with current Date/Time.
If the difference is less than 3 hours, then, a message will be displayed. My problem is that I can't get the difference in hours (I got a number and can't be change to date using StringToDate)...
I used this code:
var locked_Time = nlapiGetFieldValue('custbody_locked_time'); locked_Time = nlapiStringToDate(locked_Time); var Now = new Date(); Now = nlapiStringToDate(Now); var difference = Now - locked_Time; //following code not tested yet, since I've still can't get the value for the difference, but I added it to explain my code and what I want to do. If (difference < 3) { var html = '<script language="JavaScript" type="text/javascript">'; html += 'alert("This record in edit mode by another user")'; html += '</script>'; var htmlField = form.addField('custpage_alert', 'inlinehtml', 'This record in edit mode by another user' ,null,null); htmlField.setDefaultValue(html); } 0