Service Manager / Service Center Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

SOLVED
Go to solution
Jeff Lawrence
Collector

SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

is it possible to create a rule to set a date to 30 days beyond the current date/time?

I tried the following code that did not work:  

value=date(tod())+'30 00:00:00'"

2 REPLIES
Highlighted
AFranke
HPE Expert
Solution

Re: SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

Well, there are these two different date types:

System Language date/time

- to call System language function from JS, you'll need to use it like this: system.functions.tod(),

and

JavaScript Date.

 

In Javascript, there are following constructors for Date object:

var d = new Date();    // returns now
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);

So you can do this:

var f = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30);

 

Jeff Lawrence
Collector

Re: SM 9.4 - is it possible to create a rule to set a date to 30 days beyond today?

that worked - we used a set field using using javascript and used

value =  new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30);

BOOOOOM!! Thanks!

//Add this to "OnDomLoad" event