How to change sys_created_on datetime field value using insert business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 11:10 PM
Hello,
I have an insert/update business rule running upon sc_request table which inserts data into time_card table.
What I need is, once the sc_request REQ record is updated and the business rule reacts by inserting REQ record data into time_card, sys_created_on field in time_card table should not be filled with actual time stamp of the REQ record update time (approval datetime "timestamp") but should take the date of REQ - "Opened" field (opened_at) and insert it into time_card table sys_created_on field - please see attached screen shots.
Snippet of Gliderecord code in my business rule which should have done this but is not working:
gr.sys_created_on = current.opened_at;
But for example this snippet of code in my BR is working fine (REQ user reference field being copied to time_card user reference field)
gr.user = current.requested_for;
Many thanks for any advice,
Milan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 11:16 PM
Hello Milan,
Which business rule have you used? AFTER OR BEFORE insert/update?
Have you added gr. update(); as below?
gr.sys_created_on = current.opened_at;
gr. update();
Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 11:20 PM
You can't specify the created on date time on insert but you can update it after creation
Can you share your complete script?
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 11:40 PM
Hello,
it's after insert BR - It would be perfect to modify the sys_created_on field within the insert operation, I checked for the ACL and it's there but inactive.
Thanks a lot anyway!
Milan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 11:51 PM
Important Note here : You can't specify the created on date time on insert but you can update it after creation
So try to update sys_created_on after creating of it
Thanks,
Abhishek Gardade
Abhishek Gardade