Display Quarter number in Quarter field depend on Date

Kishore8
Kilo Guru

My script is not working

var gDate = new GlideDate(current.u_date);

Current.u_quarter= 'Q' + (Math.floor((gDate.getMonth() - 1) / 3) + 1) ;

1 ACCEPTED SOLUTION

Hi,




I have done some modification in script , it is working now


Script :



var gDate = new GlideDate();


gDate.setValue(current.u_date);


current.u_quarter= 'Q' + (Math.floor((gDate.getMonthLocalTime() - 1) / 3) + 1) ;


View solution in original post

6 REPLIES 6

Hi,




I have done some modification in script , it is working now


Script :



var gDate = new GlideDate();


gDate.setValue(current.u_date);


current.u_quarter= 'Q' + (Math.floor((gDate.getMonthLocalTime() - 1) / 3) + 1) ;


Hi,

 

Can one of you help me understand where to put this code?  We're new to Service Now.

Our specific need is to show the Due Date (requested_by) field on Demand as the Quarter instead of the full date.  I've created a new field called Quarter (u_quarter).

I've attempted to create a client script based on change for the Due Date field but get various errors.

Thanks for the help.

Bob