Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1018 Bytes

ServerScripting.md

File metadata and controls

41 lines (27 loc) · 1018 Bytes

Scripting Alert, Info, and Error Messages

Will put "Hello World" below the specified field.

current.field_name.setError("Hello World");

Will put "Hello World" on the top of the screen.

gs.addInfoMessage("Hello World");

Will write to the text log on the file system but not to the sys_log table in the database.

gs.print("Hello World");

Will write to the database and the log file.

gs.log("Hello World");

Get Difference of Two Date Times

getTimeDiff();  

function getTimeDiff(){  
  var startDate = current.u_start_date.getGlideObject();  
  var endDate = current.u_end_date.getGlideObject();  

  current.u_duration = gs.dateDiff(startDate.getDisplayValueInternal(),endDate.getDisplayValueInternal(),false);  

}