Need script to add days (taking from dropdown field)

malaisamy1
Kilo Contributor

Hi Guys,

I Have one more requirement. Could you please help me on this,

i have one date field called invoice_date where i have one more field called day_s

where day_s has dropdown values like 10,15, 30 so on.

my result field = invoice_date + day_s

that is it has to add the days whatever there in the day_s field. and stored in my result field.

result field is a date field.

Is it possible? any idea?

Thanks in Advance,

Malaisamy Ji

14 REPLIES 14

sudharsanv36
Kilo Guru

Hello Malaisamy,



Yes it is possible.



Create a onChange script() on the dropdown field.


Once the value is changed, send the new value as the parameter to server side using ajax call.



1. Initialize a glideDateTime object with current date time as parameter like var gDt =   new GlideDateTime(gs.nowDateTime())


2. convert the parameter into integer using parseInt();


3. gDt.addDays(parseInt(this.getParameter('selected_attribute')));


4. return gDt.getDisplayValue();



Hope this helps.


Sudharsan,



I am new to service now. So could you please write the and give it to me.



So that i can use it.



Thanks,


Malaisamy J


Sudharsan,



I hope Glideajax will not work in scoped application. Please check that also



Malai