Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Set a date and time field from a business rule.

ServiceNowSteve
Giga Guru

Good Morning All,

I am running a business rule on my incident table which requires me to update a time field on a different table. I have tried several iterations of the code but nothing seems to work.

The line of code I am using is

data.setValue('u_timefield', gs.now());

I have also tried SetDisplayValue as well as trying

data.u_timefield =  gs.nowDateTime();

but still nothing. Any idea how I can accomplish this?

 

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

How about just

 

current.fieldName=new GlideDateTime();

-Anurag

View solution in original post

9 REPLIES 9

Anurag Tripathi
Mega Patron
Mega Patron

How about just

 

current.fieldName=new GlideDateTime();

-Anurag

You are the MAN! Thank you sir!

What will be the conditions to use? 

Bhawana Upreti
Tera Guru

Hi,

Go to Buisness rule, select the "Action" tab, set field value of TimeField to javascript:gs.nowDateTime().

Remove your line of code. Mark the answer correct and helpful, if it answers your question.

 

Thanks.