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

Hello,

This did not work either.  Thanks

find_real_file.png

find_real_file.png

Change business to before instead of after.

and in add in advance script section 

current.u_rca = new GlideDateTime();

make sure to change u_rca to correct field name.

 

That worked.  Thanks Mike and everyone who replied.   Much appreciated.