Current date/time auto-populate

Riya17
Giga Contributor

My requirement is to auto-populate the 'sys_created_on' in another custom field 'start date' which will be read-only on the same form only for new records.  Please help me make it working.

I have a BR.

Table : User Entitlement

When to run: after

condition: start date is empty

var gDatetime = new GlideDateTime(current.sys_created_on);
if (sys_created_on==' ') {
current.u_start_date = gDatetime;
}

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi riyak,

 

Notice the screenshots below

 

find_real_file.png

 

find_real_file.png

 

find_real_file.png

 

In my dev instance, the BR works correctly.

View solution in original post

11 REPLIES 11

But I want the condition to apply only on new records not for existing records.  The above condition will apply to all records.

Run BR on insert, so it will work only for new records.

Riya17
Giga Contributor

I just ran for insert, it didn't work.  It's not populating the date.

Is it before or after? It should be after

Riya17
Giga Contributor

It is after.  Once the record is created, the date should be populated.