- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 08:10 AM
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;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 07:48 AM
Hi riyak,
Notice the screenshots below
In my dev instance, the BR works correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 08:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 08:36 AM
Hello Riyak,
I am not sure I understand your code fully. Its getting the GDT of the sys_created_on field, then checking if that field is blank, and if it is blank fill it with the GDT from the blank field? It seems like it would not work because the time would be blank.
If sys_created_on is already a time field, you could just set start date to the same thing.
current.u_start_date = current.sys_created_on;
Also, in your IF statement, you don't have sys_created_on set as anything. You would need current, but again if it is empty then gDatetime would also be empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 09:02 AM
I gave 'current for sys_created_on in IF statement, still not working.
var gDatetime = new GlideDateTime(current.sys_created_on);
if (sys_created_on=='current ') {
current.u_start_date = gDatetime;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 08:39 AM