Set Current Date Time In Business Rule Action

thisisauniqueus
Giga Expert

Hi

How can i set the value of a field(work start) to current Date Time based on another filed's value in a business rule action?

find_real_file.png

Regards.

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Hi John,



Please see the link below.



Set date via business rule action



Regards,


Harshvardhan



PS - Please mark Helpful, Like, or Correct Answer if applicable.


View solution in original post

10 REPLIES 10

Since you are updating fields on the current object, this should be a BEFORE business rule (and remove current.update().)

Your script can then look like this:

var now = new GlideDateTime();
current.u_resolved_on_date = now;

if u_resolved_on_date is a DATE (and not a date/time field) use this:

var now = new GlideDate();
current.u_resolved_on_date = now;

Hi Chuck,

Thanks for your prompt response.

My bad it is not working. PFA screen shorts, i don't no where i am doing mistake.

 

 

I tried in my personal instance so many ways.

 

1. Before--> insert or update

2. Before--> insert

3. Before --> Update

3. After -->insert

4. After --> update

5. After --> insert or update

 

When state changes to closed complete, the resolved date field should set the current date and time.

I took field type as "date/time".

 

"Actual requirement is we need to set the resolved state field with current date and time---> when state changes to resolved"

Harsh Vardhan
Giga Patron

Hi John,



Please see the link below.



Set date via business rule action



Regards,


Harshvardhan



PS - Please mark Helpful, Like, or Correct Answer if applicable.


Abhinay Erra
Giga Sage

Use javascript:gs.nowDateTime() in your conditions.