- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 04:07 PM
Hi helpful friends!
I previous opened a thread with a question to get a date field to auto populate when any change to a form is made, and it worked. However it does not autopopulate if the first thing that is done on the form is to create a new record from a related list on the record. Is this possible?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2017 05:11 PM
Ahh !!
I totally forgot that you are using scoped application
replace the below line
gr.date_reviewed = gs.nowDateTime();
with
gr.date_reviewed = new GlideDateTime();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2017 04:26 PM
Yes. If you can give us the table and field names then we can help you with the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2017 04:29 PM
should be same as other business rule that you have with couple of changes
Table name changes to the related list table and on insert
and in case if you are using set values you will have to dot walk to the parent fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2017 04:35 PM
parent table = "x_cur_oc_feedback_oc_feedback"
parent table field I want to auto populate with date/time = "date_reviewed"
child table = "x_cur_oc_feedback_tasks"
trigger to auto poplulate the parent table field (if blank at the time) = when first record in the child table is inserted/saved/updated
thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2017 04:41 PM
Write a after insert business rule on x_cur_oc_feedback_tasks table and use the below script
update parent_reference_field
var gr = new GlideRecord('x_cur_oc_feedback_oc_feedback');
gr.addQuery('sys_id', current.parent_reference_field); // parent_reference_field is the field that is relating parent and child table on child form
gr.query();
while(gr.next()){
gr.date_reviewed = gs.nowDateTime();
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2017 05:01 PM