set current date and time to a field using business rule

Chaitanya Chowd
Kilo Expert

Hi All,

I want to set a field to particular Date and Time. I wrote a "before business rule" which will trigger when "State" is changed to "Awaiting user info" and i want to set this particular time and date to the field.

I wrote the following script, but it is not working.

(function executeRule(current, previous /*null when async*/) {

var rightNow = new GlideDatetime();

current.setValue(u_aui_time,rightNow.getValue());

})(current, previous);

Kindly provide your valuable inputs

Thanks in advance

dcn

1 ACCEPTED SOLUTION

Thanks for input.



i found the answer. This will do without scripting



find_real_file.png


View solution in original post

7 REPLIES 7

jimnicholson
Giga Guru

I believe you need a capital T in GlideDateTime, also I'm not 100% certain that ".getValue()" is necessary, but it shouldn't be hurting anything.  



GlideDateTime();


Thanks for input.



i found the answer. This will do without scripting



find_real_file.png


Hello,

This did not work for me.   I want to set based upon problem state changes to RCA Complete then RCA Completion date to the current date/time in Business Rule.

Thanks,

Chad

Is the field a datetime field or date field.

If datetime use above. If date try using javascript: gs.now()