The CreatorCon Call for Content is officially open! Get started here.

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

8 REPLIES 8

Anurag Tripathi
Mega Patron
Mega Patron

How about just

 

current.fieldName=new GlideDateTime();

-Anurag

You are the MAN! Thank you sir!

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.

ServiceNowSteve
Giga Guru

Thanks for the reply, unfortunately it's not the current incident form that needs the update it's a different table.